~ps10gel/ubuntu/xenial/trafficserver/6.2.0

« back to all changes in this revision

Viewing changes to configure.ac

  • Committer: Bazaar Package Importer
  • Author(s): Arno Toell
  • Date: 2011-01-13 11:49:18 UTC
  • Revision ID: james.westby@ubuntu.com-20110113114918-vu422h8dknrgkj15
Tags: upstream-2.1.5-unstable
ImportĀ upstreamĀ versionĀ 2.1.5-unstable

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Process this file with `autoreconf -i` to create a 'configure' file.
 
2
 
 
3
#  Licensed to the Apache Software Foundation (ASF) under one
 
4
#  or more contributor license agreements.  See the NOTICE file
 
5
#  distributed with this work for additional information
 
6
#  regarding copyright ownership.  The ASF licenses this file
 
7
#  to you under the Apache License, Version 2.0 (the
 
8
#  "License"); you may not use this file except in compliance
 
9
#  with the License.  You may obtain a copy of the License at
 
10
#
 
11
#      http://www.apache.org/licenses/LICENSE-2.0
 
12
#
 
13
#  Unless required by applicable law or agreed to in writing, software
 
14
#  distributed under the License is distributed on an "AS IS" BASIS,
 
15
#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
16
#  See the License for the specific language governing permissions and
 
17
#  limitations under the License.
 
18
 
 
19
# Table of Contents
 
20
# 1. INITIALIZATION
 
21
# 2. SITE CONFIGURATION
 
22
# 3. CHECK FOR PROGRAMS
 
23
# 4. CHECK FOR LIBRARIES
 
24
# 5. CHECK FOR HEADERS
 
25
# 6. OUTPUT FILES
 
26
# 7. autoheader TEMPLATES
 
27
 
 
28
# -----------------------------------------------------------------------------
 
29
# 1. INITIALIZATION
 
30
 
 
31
# These first two version numbers are updated automatically on each release.
 
32
# Version number is calculated as MAJOR * 1000000 + MINOR * 1000 + MICRO
 
33
# Version string is in the form of MAJOR.MINOR.MICRO[sufix]
 
34
#
 
35
m4_define([TS_VERSION_S],[2.1.5-unstable])
 
36
m4_define([TS_VERSION_N],[2001005])
 
37
 
 
38
AC_INIT([Apache Traffic Server], TS_VERSION_S(), [dev@trafficserver.apache.org], [trafficserver],[http://trafficserver.apache.org])
 
39
AC_PREREQ([2.59])
 
40
AC_CONFIG_AUX_DIR([build/aux])
 
41
AC_CONFIG_SRCDIR([proxy/Main.cc])
 
42
AC_CONFIG_MACRO_DIR([build])
 
43
AM_INIT_AUTOMAKE([-Wall -Werror foreign no-installinfo no-installman 1.9.2])
 
44
AM_CONFIG_HEADER([lib/ts/ink_autoconf.h])
 
45
 
 
46
# Not sure this is needed, and seems to break with some versions of automake
 
47
#LT_INIT([dlopen])
 
48
 
 
49
# Libtool versioning uses different conventions on different
 
50
# platforms.  At least on FreeBSD, libtool uses an overly complex
 
51
# convention that attempts to solve problems that most people just
 
52
# don't have and which just causes confusion for most end users.
 
53
#
 
54
TS_VERSION_MAJOR=$((TS_VERSION_N() / 1000000 ))
 
55
TS_VERSION_MINOR=$(((TS_VERSION_N() / 1000) % 1000 ))
 
56
TS_VERSION_MICRO=$((TS_VERSION_N() % 1000 ))
 
57
TS_LIBTOOL_MAJOR=`echo $((${TS_VERSION_MAJOR} + ${TS_VERSION_MINOR}))`
 
58
TS_LIBTOOL_VERSION=$TS_LIBTOOL_MAJOR:$TS_VERSION_MICRO:$TS_VERSION_MINOR
 
59
TS_VERSION_STRING=TS_VERSION_S()
 
60
TS_VERSION_NUMBER=TS_VERSION_N()
 
61
 
 
62
#
 
63
# Substitute the above version numbers into the various files below.
 
64
#
 
65
AC_SUBST(TS_LIBTOOL_VERSION)
 
66
AC_SUBST(TS_VERSION_STRING)
 
67
AC_SUBST(TS_VERSION_NUMBER)
 
68
AC_SUBST(TS_VERSION_MAJOR)
 
69
AC_SUBST(TS_VERSION_MINOR)
 
70
AC_SUBST(TS_VERSION_MICRO)
 
71
 
 
72
dnl Hard-coded top of ink_autoconf.h:
 
73
AH_TOP([
 
74
#ifndef _ink_autoconf_h
 
75
#define _ink_autoconf_h
 
76
])
 
77
 
 
78
dnl Hard-coded inclusion at the tail end of ink_autoconf.h:
 
79
AH_BOTTOM([
 
80
 
 
81
#endif /* _ink_autoconf_h */
 
82
])
 
83
 
 
84
#
 
85
# Generate ./config.nice for reproducing runs of configure
 
86
#
 
87
TS_CONFIG_NICE([config.nice])
 
88
 
 
89
# XXX we can't just use AC_PREFIX_DEFAULT because that isn't subbed in
 
90
# by configure until it is too late.  Is that how it should be or not?
 
91
# Something seems broken here.
 
92
AC_PREFIX_DEFAULT([/usr/local/trafficserver])
 
93
 
 
94
# Get the layout here, so we can pass the required variables to Trafficserver
 
95
TS_ENABLE_LAYOUT(TrafficServer, [cachedir])
 
96
 
 
97
# Reparse the configure arguments so we can override the layout.
 
98
TS_PARSE_ARGUMENTS
 
99
 
 
100
#
 
101
# Host detection
 
102
#
 
103
AC_CANONICAL_HOST
 
104
HOST_GUESS="$host"
 
105
AC_SUBST(HOST_GUESS)
 
106
 
 
107
#
 
108
# Build environment
 
109
#
 
110
build_person="`id -nu`"
 
111
build_group="`id -ng`"
 
112
build_machine="`uname -n`"
 
113
AC_SUBST([build_machine])
 
114
AC_SUBST([build_person])
 
115
AC_SUBST([build_group])
 
116
 
 
117
AC_ARG_WITH([user],
 
118
  [AS_HELP_STRING([--with-user],[specify the system user [default: nobody]])],
 
119
  [
 
120
  with_user="$withval"
 
121
  ],[
 
122
  with_user="nobody"
 
123
  ]
 
124
)
 
125
 
 
126
AC_ARG_WITH([group],
 
127
  [AS_HELP_STRING([--with-group],[specify the system group [default: nogroup]])],
 
128
  [
 
129
  with_group="$withval"
 
130
  ],[
 
131
  with_group="nobody"
 
132
  ]
 
133
)
 
134
AC_SUBST([pkgsysuser],[$with_user])
 
135
AC_SUBST([pkgsysgroup],[$with_group])
 
136
 
 
137
# -----------------------------------------------------------------------------
 
138
# 2. SITE CONFIGURATION
 
139
 
 
140
#
 
141
# Debug
 
142
#
 
143
 
 
144
AC_MSG_CHECKING([whether to enable debugging])
 
145
AC_ARG_ENABLE([debug],
 
146
  [AS_HELP_STRING([--enable-debug],[turn on debugging])],
 
147
  [],
 
148
  [enable_debug=no]
 
149
)
 
150
AC_MSG_RESULT([$enable_debug])
 
151
 
 
152
#
 
153
# Diags
 
154
#
 
155
 
 
156
use_diags=0
 
157
AC_MSG_CHECKING([whether to enable diags])
 
158
AC_ARG_ENABLE([diags],
 
159
  [AS_HELP_STRING([--disable-diags],[turn off diags])],
 
160
  [],
 
161
  [enable_diags="yes"
 
162
   use_diags=1
 
163
  ]
 
164
)
 
165
AC_MSG_RESULT([$enable_diags])
 
166
AC_SUBST(use_diags)
 
167
 
 
168
#
 
169
# Build regression tests?
 
170
#
 
171
 
 
172
has_tests=0
 
173
AC_MSG_CHECKING([whether to enable regression tests])
 
174
AC_ARG_ENABLE([tests],
 
175
  [AS_HELP_STRING([--disable-tests],[turn off regression tests])],
 
176
  [],
 
177
  [enable_tests="yes"
 
178
   has_tests=1
 
179
  ]
 
180
)
 
181
AC_MSG_RESULT([$enable_tests])
 
182
AC_SUBST(has_tests)
 
183
AM_CONDITIONAL([BUILD_TESTS], [test "x$enable_tests" = "xyes"])
 
184
 
 
185
#
 
186
# Purify
 
187
#
 
188
has_purify=0
 
189
AC_MSG_CHECKING([whether to enable purify])
 
190
AC_ARG_ENABLE([purify],
 
191
  [AS_HELP_STRING([--enable-purify],[enable support for Purify])],
 
192
  [has_purify=1],
 
193
  [enable_purify=no]
 
194
)
 
195
AC_MSG_RESULT([$enable_purify])
 
196
AC_SUBST(has_purify)
 
197
 
 
198
#
 
199
# libev
 
200
#
 
201
 
 
202
AC_MSG_CHECKING([whether to use libev even if not required])
 
203
AC_ARG_ENABLE([libev],
 
204
  [AS_HELP_STRING([--enable-libev],[use libev even if not required])],
 
205
  [],
 
206
  [enable_libev=no]
 
207
)
 
208
AC_MSG_RESULT([$enable_libev])
 
209
 
 
210
 
 
211
#
 
212
# Micro
 
213
#
 
214
is_micro_build=0
 
215
AC_MSG_CHECKING([whether to enable micro-TS])
 
216
AC_ARG_ENABLE([micro],
 
217
  [AS_HELP_STRING([--enable-micro],[enable micro-TS build [default: no]])],
 
218
  [is_micro_build=1],
 
219
  [enable_micro=no]
 
220
)
 
221
AC_SUBST(is_micro_build)
 
222
AC_MSG_RESULT([$enable_micro])
 
223
 
 
224
#
 
225
# Standalone iocore
 
226
#
 
227
has_standalone_iocore=0
 
228
AC_MSG_CHECKING([whether to build a standalone iocore])
 
229
AC_ARG_ENABLE([standalone-iocore],
 
230
  [AS_HELP_STRING([--enable-standalone-iocore],[build just standalone iocore])],
 
231
  [has_standalone_iocore=1],
 
232
  [enable_standalone_iocore=no]
 
233
)
 
234
AC_MSG_RESULT([$enable_standalone_iocore])
 
235
AC_SUBST(has_standalone_iocore)
 
236
AS_IF([test "x$enable_standalone_iocore" = "xyes"],
 
237
  [AC_SUBST([IOCORE_MODULARIZED_DEFS],[""])
 
238
   AC_SUBST([ink_with_modules_def],["-DREC_BUILD_STAND_ALONE"])
 
239
   AC_SUBST([ink_with_modules_local],[""])
 
240
   AC_SUBST([ink_with_modules_process],[""])
 
241
   AC_SUBST([hdr_dirs],"proxy/hdrs")
 
242
  ],
 
243
  [AC_SUBST([ink_with_modules_def],["-DREC_BUILD_MGMT2"])
 
244
   AC_SUBST([ink_with_modules_local],["-DLOCAL_MANAGER"])
 
245
   AC_SUBST([ink_with_modules_process],["-DPROCESS_MANAGER"])
 
246
  ]
 
247
)
 
248
AM_CONDITIONAL([STANDALONE_IOCORE], [test "x$enable_standalone_iocore" = "xyes"])
 
249
 
 
250
#
 
251
# Remote Coverity Prevent commit
 
252
#
 
253
AC_MSG_CHECKING([whether to commit cov defects to remote host])
 
254
AC_ARG_ENABLE([remote-cov-commit],
 
255
  [AS_HELP_STRING([--enable-remote-cov-commit[=HOST]], [commit cov defects to remote host [HOST=localhost]])],
 
256
  [],
 
257
  [enable_remote_cov_commit=localhost]
 
258
)
 
259
AC_MSG_RESULT([$enable_remote_cov_commit])
 
260
AC_SUBST([enable_remote_cov_commit])
 
261
 
 
262
#
 
263
# WebUI
 
264
#
 
265
has_webui=0
 
266
AC_MSG_CHECKING([whether to enable Web UI])
 
267
AC_ARG_ENABLE([webui],
 
268
  [AS_HELP_STRING([--enable-webui],[enable Web UI [default: no]])],
 
269
  [has_webui=1],
 
270
  [enable_webui=no]
 
271
)
 
272
AC_MSG_RESULT([$enable_webui])
 
273
AC_SUBST(has_webui)
 
274
AM_CONDITIONAL([BUILD_WEBUI], [test "x$enable_webui" = "xyes"])
 
275
 
 
276
#
 
277
# API
 
278
#
 
279
has_inkapi=1
 
280
AC_MSG_CHECKING([whether to enable API and plugin support])
 
281
AC_ARG_ENABLE([api],
 
282
  [AS_HELP_STRING([--disable-api],[do not enable API and plugin support])],
 
283
  [has_inkapi=0],
 
284
  [enable_api=yes]
 
285
)
 
286
AC_MSG_RESULT([$enable_api])
 
287
AC_SUBST(has_inkapi)
 
288
 
 
289
#
 
290
# Detailed Logging (for debugging purposes)
 
291
#
 
292
has_detailed_log=0
 
293
AC_MSG_CHECKING([whether to enable detailed logging for debugging purposes])
 
294
AC_ARG_ENABLE([detailed-log],
 
295
  [AS_HELP_STRING([--enable-detailed-log],[enable detailed logging])],
 
296
  [has_detailed_log=1],
 
297
  [enable_detailed_log=no]
 
298
)
 
299
AC_MSG_RESULT([$enable_detailed_log])
 
300
AC_SUBST(has_detailed_log)
 
301
AM_CONDITIONAL([BUILD_DETAILED_LOG], [test "x$enable_detailed_log" = "xyes"])
 
302
 
 
303
#
 
304
# Cli2
 
305
#
 
306
has_cli2=1
 
307
AC_MSG_CHECKING([whether to enable cli2])
 
308
AC_ARG_ENABLE([cli2],
 
309
  [AS_HELP_STRING([--disable-cli2],[do not compile cli2])],
 
310
  [has_cli2=0],
 
311
  [enable_cli2=yes]
 
312
)
 
313
AC_MSG_RESULT([$enable_cli2])
 
314
AS_IF([test "x$enable_cli2" = "xyes"],
 
315
  [AC_SUBST([CLI_DIR],[cli2])]
 
316
)
 
317
AC_SUBST(has_cli2)
 
318
 
 
319
#
 
320
# Experimental V2 stats APIs (for plugins)
 
321
#
 
322
has_v2stats=0
 
323
AC_MSG_CHECKING([whether to enable the experimental V2 stats subsystem for plugin APIs])
 
324
AC_ARG_ENABLE([v2stats],
 
325
  [AS_HELP_STRING([--enable-v2stats],[enable experimental V2 stats API])],
 
326
  [has_v2stats=1],
 
327
  [enable_v2stats=no]
 
328
)
 
329
AC_MSG_RESULT([$enable_v2stats])
 
330
AC_SUBST(has_v2stats)
 
331
AM_CONDITIONAL([BUILD_V2STATS], [test "x$enable_v2stats" = "xyes"])
 
332
 
 
333
#
 
334
# WCCP
 
335
#
 
336
has_wccp=0
 
337
AC_MSG_CHECKING([whether to enable WCCP v2 support])
 
338
AC_ARG_ENABLE([wccp],
 
339
  [AS_HELP_STRING([--enable-wccp],[enable WCCP v2])],
 
340
  [
 
341
    has_wccp=1
 
342
  ],
 
343
  [enable_wccp=no]
 
344
)
 
345
AC_MSG_RESULT([$enable_wccp])
 
346
AC_SUBST(has_wccp)
 
347
AM_CONDITIONAL([BUILD_WCCP], [test "x$enable_wccp" = "xyes"])
 
348
 
 
349
# Google profiler
 
350
AC_MSG_CHECKING([whether to enable profiler])
 
351
AC_ARG_WITH([profiler],
 
352
  [AS_HELP_STRING([--with-profiler],[enable support for profiler [default=no]])],
 
353
  [with_profiler=$withval],
 
354
  [with_profiler=no]
 
355
)
 
356
AC_MSG_RESULT([$with_profiler])
 
357
 
 
358
#
 
359
# use eventfd() or pipes
 
360
# Found that ec2 is using an older kernel causing eventfd errors.
 
361
# Disable eventfd when using ATS on EC2 Fedora.
 
362
#
 
363
AC_MSG_CHECKING([whether to enable eventfd()])
 
364
AC_ARG_ENABLE([eventfd],
 
365
  [AS_HELP_STRING([--disable-eventfd],[turn off eventfd and use pipes])],
 
366
  [],
 
367
  [enable_eventfd="yes"]
 
368
)
 
369
AC_MSG_RESULT([$enable_eventfd])
 
370
 
 
371
#
 
372
# use POSIX capabilities instead of user ID switching.
 
373
#
 
374
AC_MSG_CHECKING([whether to use POSIX capabilities])
 
375
AC_ARG_ENABLE([posix-cap],
 
376
  [AS_HELP_STRING([--disable-posix-cap],[Use user id switching instead of POSIX capabilities])],
 
377
  [],
 
378
  [enable_posix_cap="yes"]
 
379
)
 
380
AC_MSG_RESULT([$enable_posix_cap])
 
381
 
 
382
#
 
383
# Disable ccache explicitly (it's enabled by default, if it exists)
 
384
#
 
385
AC_MSG_CHECKING([whether to explicitly disable ccache])
 
386
AC_ARG_ENABLE([ccache],
 
387
  [AS_HELP_STRING([--disable-ccache],[Disable ccache from being used])],
 
388
  [],
 
389
  [enable_ccache="yes"]
 
390
)
 
391
AC_MSG_RESULT([$enable_ccache])
 
392
 
 
393
#
 
394
# Use TPROXY for connection transparency.
 
395
#
 
396
AC_MSG_CHECKING([whether to enable TPROXY based transparency])
 
397
AC_ARG_ENABLE([tproxy],
 
398
  [AS_HELP_STRING([--enable-tproxy[[=ARG]]],
 
399
                  [Use TPROXY to enable connection transparency.
 
400
                   'auto' or omitted for local system default,
 
401
                   'no' to disable,
 
402
                   'force' to use built in default,
 
403
                   number to use as IP_TRANSPARENT sockopt.
 
404
                   [default=auto]
 
405
                  ])
 
406
  ],
 
407
  [],
 
408
  [enable_tproxy="auto"]
 
409
)
 
410
AC_MSG_RESULT([$enable_tproxy])
 
411
 
 
412
#
 
413
# Configure how many stats to allocate for plugins. Default is 512.
 
414
#
 
415
AC_ARG_WITH([max-api-stats],
 
416
  [AS_HELP_STRING([--with-max-api-stats],[max number of plugin stats [default=512]])],
 
417
  [max_api_stats=$withval],
 
418
  [max_api_stats=512]
 
419
)
 
420
AC_SUBST(max_api_stats)
 
421
 
 
422
#
 
423
# Installation directories
 
424
# For each var the following is evaluated
 
425
# foo      Standard variable  eg. ${prefix}/foo
 
426
# rel_foo  Relative to prefix eg. foo
 
427
#
 
428
TS_SUBST_LAYOUT_PATH([prefix])
 
429
TS_SUBST_LAYOUT_PATH([exec_prefix])
 
430
TS_SUBST_LAYOUT_PATH([bindir])
 
431
TS_SUBST_LAYOUT_PATH([sbindir])
 
432
TS_SUBST_LAYOUT_PATH([libdir])
 
433
TS_SUBST_LAYOUT_PATH([libexecdir])
 
434
TS_SUBST_LAYOUT_PATH([infodir])
 
435
TS_SUBST_LAYOUT_PATH([mandir])
 
436
TS_SUBST_LAYOUT_PATH([sysconfdir])
 
437
TS_SUBST_LAYOUT_PATH([datadir])
 
438
TS_SUBST_LAYOUT_PATH([installbuilddir])
 
439
TS_SUBST_LAYOUT_PATH([includedir])
 
440
TS_SUBST_LAYOUT_PATH([localstatedir])
 
441
TS_SUBST_LAYOUT_PATH([runtimedir])
 
442
TS_SUBST_LAYOUT_PATH([logdir])
 
443
TS_SUBST_LAYOUT_PATH([cachedir])
 
444
 
 
445
TS_SUBST([pkgbindir])
 
446
TS_SUBST([pkgsbindir])
 
447
TS_SUBST([pkglibdir])
 
448
TS_SUBST([pkglibexecdir])
 
449
TS_SUBST([pkgsysconfdir])
 
450
TS_SUBST([pkgdatadir])
 
451
TS_SUBST([pkglocalstatedir])
 
452
TS_SUBST([pkgruntimedir])
 
453
TS_SUBST([pkglogdir])
 
454
TS_SUBST([pkgcachedir])
 
455
 
 
456
 
 
457
# -----------------------------------------------------------------------------
 
458
# 3. CHECK FOR PROGRAMS
 
459
 
 
460
# Compiler selection:
 
461
#
 
462
# Implementation note (toc)
 
463
# 1) Get default compiler settings (case statement.)
 
464
# 2) Check for over-rides of default compiler.
 
465
# 3) Set standard CFLAGS, SHARED_CFLAGS, etc.
 
466
# 4) (in first kludge mode block...) obtain any further CFLAG-type additions.
 
467
# 5) Test compilers with all flags set.
 
468
 
 
469
# AC_PROG can sometimes mangle CFLAGS etc.
 
470
# in particular, on Linux they insert -g -O2, here we preserve any user CFLAGS
 
471
 
 
472
#CC=gcc
 
473
#CXX=g++
 
474
 
 
475
REAL_CFLAGS="${CFLAGS}"
 
476
REAL_CXXFLAGS="${CXXFLAGS}"
 
477
REAL_CCASFLAGS="${CCASFLAGS}"
 
478
 
 
479
AC_PROG_CC
 
480
AC_PROG_CXX
 
481
 
 
482
# Check for ccache (unless disabled explicitly)
 
483
if test "x$enable_ccache" = "xyes"; then
 
484
    AC_CHECK_PROG([CCACHE],[ccache],[ccache],[])
 
485
    if test "x${CCACHE}" = "xccache"; then
 
486
        CC="$CCACHE $CC"
 
487
        CXX="$CCACHE $CXX"
 
488
    fi
 
489
fi
 
490
 
 
491
dnl AC_PROG_SED is only avaliable in recent autoconf versions.
 
492
dnl Use AC_CHECK_PROG instead if AC_PROG_SED is not present.
 
493
ifdef([AC_PROG_SED],
 
494
      [AC_PROG_SED],
 
495
      [AC_CHECK_PROG(SED, sed, sed)])
 
496
 
 
497
AC_PROG_CPP
 
498
AC_PROG_CXXCPP
 
499
AM_PROG_AS
 
500
AC_PROG_AWK
 
501
AC_PROG_LN_S
 
502
AC_PROG_INSTALL
 
503
AC_PROG_LIBTOOL
 
504
AC_CHECK_PROG(RM, rm, rm)
 
505
AC_CHECK_PROG(ASCPP, cpp, cpp)
 
506
AC_CHECK_TOOL(AR, ar, ar)
 
507
AC_ISC_POSIX
 
508
AS_IF([test "x$enable_wccp" = "xyes"],
 
509
  [
 
510
    AC_PROG_YACC
 
511
    AC_PROG_LEX
 
512
  ]
 
513
)
 
514
 
 
515
AC_PATH_PROG([DOXYGEN], [doxygen]) # needed for Doxygen
 
516
AC_PATH_PROG([PERL],[perl],[not found])
 
517
AS_IF([test "x$PERL" = "xnot found"],
 
518
  [AC_MSG_ERROR([check for perl failed. Have you installed perl?])]
 
519
)
 
520
AC_ARG_VAR([DOXYGEN], [full path of Doxygen executable])
 
521
AC_ARG_VAR([PERL], [full path of Perl executable])
 
522
 
 
523
CFLAGS="${REAL_CFLAGS}"
 
524
CXXFLAGS="${REAL_CXXFLAGS}"
 
525
CCASFLAGS="${REAL_CCASFLAGS}"
 
526
 
 
527
base_cc=`basename $CC`
 
528
# These are shortcuts used in combination for the compiler options below
 
529
case $host_os in
 
530
  linux*)
 
531
    if test "x${base_cc}" = "xicc"; then
 
532
      # -Wall goes crazy, so turned these specific checks off for now:
 
533
      #
 
534
      #  111 is "statement is unrecahable"
 
535
      #  279 is "controlling expression is constant", triggered by our asserts
 
536
      #  383 is "value copied to temporary, reference to temporary used"
 
537
      #  444 is "destructor for base class is not virtual"
 
538
      #  522 is "function "xyz" redeclared "inline" after being called
 
539
      #  873 is "has no corresponding operator delete". ToDo: we should fix.
 
540
      #  981 is "operands are evaluated in unspecified order"
 
541
      # 1418 is "external function definition with no prior declaration"
 
542
      # 1419 is "external declaration in primary source file"
 
543
      # 1572 is "floating-point equality and inequality comparisons are unreliable"
 
544
      # 1720 is "operator new" has no corresponding member operator delete"
 
545
      # 2256 is "non-pointer conversion from "int" to "unsigned char" "
 
546
      # 2259 is "non-pointer conversion from "int" to "unsigned char" "
 
547
      # 
 
548
      # TODO: We should try to eliminate more of these -wd exclusions.
 
549
      common_opt="-pipe -Wall -wd111 -wd279 -wd383 -wd522 -wd444 -wd873 -wd981 -wd1418 -wd1419 -wd1572 -wd1720 -wd2256 -wd2259"
 
550
      debug_opt="-ggdb3 $common_opt"
 
551
      release_opt="-g $common_opt -O2 -axsse4.2 -fno-strict-aliasing"
 
552
      cxx_opt="-Wno-invalid-offsetof"
 
553
    else # gcc
 
554
    # This is useful for finding odd conversions
 
555
    #    common_opt="-pipe -Wall -Werror -Wconversion -Wno-sign-conversion"
 
556
      common_opt="-pipe -Wall -Werror"
 
557
      debug_opt="-ggdb3 $common_opt"
 
558
      release_opt="-g $common_opt -O3 -feliminate-unused-debug-symbols -fno-strict-aliasing"
 
559
      cxx_opt="-Wno-invalid-offsetof"
 
560
    fi
 
561
    ;;
 
562
  darwin*)
 
563
    common_opt="-pipe -Wall -Werror"
 
564
    debug_opt="-ggdb3 $common_opt"
 
565
    release_opt="-g $common_opt -O3 -feliminate-unused-debug-symbols -fno-strict-aliasing"
 
566
    cxx_opt="-Wno-invalid-offsetof"
 
567
    TS_ADDTO(CPPFLAGS, [-I/opt/local/include])
 
568
    TS_ADDTO(LDFLAGS, [-L/opt/local/lib])
 
569
    ;;
 
570
  freebsd*)
 
571
    common_opt="-pipe -Wall -Werror"
 
572
    debug_opt="-ggdb3 $common_opt"
 
573
    release_opt="-g $common_opt -O3 -feliminate-unused-debug-symbols -fno-strict-aliasing"
 
574
    cxx_opt="-Wno-invalid-offsetof"
 
575
    TS_ADDTO(LDFLAGS, [-L/usr/local/lib])
 
576
    ;;
 
577
  solaris*)
 
578
    if test "x${base_cc}" = "xcc"; then
 
579
      common_opt="-mt -m64 -D__WORDSIZE=64" # FIXME: arch should be detected
 
580
      CCASFLAGS="-Wa,-32" # TODO: add 64bit support to atomic ops
 
581
      debug_opt="-g $common_opt"
 
582
      release_opt="-g $common_opt -xO3"
 
583
      cxx_opt="-library=stlport4"
 
584
      cxx_dbg="+w2"
 
585
      cxx_rel="-erroff"
 
586
      AC_DEFINE([_POSIX_PTHREAD_SEMANTICS],1,
 
587
       [posix thread semantics]
 
588
      )
 
589
    else # gcc
 
590
      common_opt="-pipe -Wall -Werror"
 
591
      debug_opt="-ggdb3 $common_opt"
 
592
      release_opt="-g $common_opt -O3 -feliminate-unused-debug-symbols -fno-strict-aliasing"
 
593
      cxx_opt="-Wno-invalid-offsetof"
 
594
    fi
 
595
    TS_ADDTO(LDFLAGS, [-L/lib])
 
596
    TS_ADDTO(LDFLAGS, [-L/usr/local/lib])
 
597
    ;;
 
598
  *)
 
599
    common_opt="-pipe -Wall -Werror"
 
600
    debug_opt="-ggdb3 $common_opt"
 
601
    release_opt="-g $common_opt -O3 -feliminate-unused-debug-symbols -fno-strict-aliasing"
 
602
    cxx_opt="-Wno-invalid-offsetof"
 
603
    ;;
 
604
esac
 
605
 
 
606
cc_oflag_opt=$release_opt
 
607
cc_oflag_dbg=$debug_opt
 
608
cxx_oflag_opt="$release_opt $cxx_opt $cxx_rel"
 
609
cxx_oflag_dbg="$debug_opt $cxx_opt $cxx_dbg"
 
610
 
 
611
SHARED_CFLAGS=-fPIC
 
612
SHARED_LDFLAGS=-shared
 
613
SHARED_CXXFLAGS=-fPIC
 
614
SHARED_CXXLINKFLAGS=-shared
 
615
 
 
616
dnl Checks for pointer size
 
617
AC_CHECK_SIZEOF(void*, 4)
 
618
if test "x$ac_cv_sizeof_voidp" == "x"; then
 
619
  AC_ERROR([Cannot determine size of void*])
 
620
fi
 
621
AC_SUBST(ac_cv_sizeof_voidp)
 
622
 
 
623
 
 
624
# Checks for TCP defer accept
 
625
case $host_os in
 
626
  linux*)
 
627
    defer_accept=45
 
628
    ;;
 
629
  *)
 
630
    defer_accept=1
 
631
    ;;
 
632
esac
 
633
AC_SUBST(defer_accept)
 
634
 
 
635
 
 
636
#
 
637
# Here are all the extra linux-specific C(XX)FLAGS additions and
 
638
# so forth.
 
639
# TODO cpu architecture settings separate from operating system settings
 
640
#
 
641
cpu_architecture=""
 
642
# GCC: add a default march if there is not one set
 
643
if test "x${GCC}" = "xyes"; then
 
644
  if test "${ac_cv_sizeof_voidp}" = "4"; then
 
645
    case "$host_cpu" in
 
646
      i?86* | k[5-8]* | pentium* | athlon)
 
647
        cpu_architecture="-march=i586"
 
648
      ;;
 
649
      *sparc*)
 
650
        cpu_architecture="-mv8"
 
651
      ;;
 
652
    esac
 
653
  else
 
654
    case "$host_cpu" in
 
655
      x86_64 | amd64)
 
656
        # XXX: Any need for 64-bit arch flags?
 
657
        # cpu_architecture="-march=native"
 
658
      ;;
 
659
      *sparc*)
 
660
        cpu_architecture="-march=ultrasparc"
 
661
      ;;
 
662
    esac
 
663
  fi
 
664
  # TODO: Add support for other compilers
 
665
  #
 
666
fi
 
667
 
 
668
# Overrride detected architecture with the user suplied one
 
669
#
 
670
AC_ARG_WITH(architecture, [AC_HELP_STRING([--with-architecture=ARCH],[use a specific CPU architecture])],
 
671
[
 
672
  if test "x$withval" != "xyes" && test "x$withval" != "xno"; then
 
673
    case "$withval" in
 
674
      -*)
 
675
        # TODO: In case we are cross compiling some of the provided flags
 
676
        #       should be added to the LDFLAGS
 
677
        cpu_architecture="$withval"
 
678
      ;;
 
679
      *)
 
680
        cpu_architecture="-march=$withval"
 
681
      ;;
 
682
    esac
 
683
  elif test "x$withval" = "x"; then
 
684
    AC_MSG_ERROR([--with-architecture requires an param])
 
685
  fi
 
686
])
 
687
 
 
688
if test "x$cpu_architecture" != "x"; then
 
689
  TS_ADDTO(CFLAGS, [$cpu_architecture])
 
690
  TS_ADDTO(CXXFLAGS, [$cpu_architecture])
 
691
fi
 
692
 
 
693
# 64-bit LFS support
 
694
#
 
695
TS_ADDTO(CPPFLAGS, [-D_LARGEFILE64_SOURCE=1])
 
696
if test "${ac_cv_sizeof_voidp}" = "8"; then
 
697
  TS_ADDTO(CPPFLAGS, [-D_COMPILE64BIT_SOURCE=1])
 
698
else
 
699
  TS_ADDTO(CPPFLAGS, [-D_FILE_OFFSET_BITS=64])
 
700
fi
 
701
TS_ADDTO(CPPFLAGS, [-D_GNU_SOURCE])
 
702
TS_ADDTO(CPPFLAGS, [-D_REENTRANT])
 
703
 
 
704
case $host_os in
 
705
  linux*)
 
706
    EXTRA_CXX_LDFLAGS="-rdynamic"
 
707
    host_os_def=linux
 
708
    ;;
 
709
  darwin*)
 
710
    host_os_def=darwin
 
711
    ;;
 
712
  freebsd*)
 
713
    EXTRA_CXX_LDFLAGS="-rdynamic"
 
714
    host_os_def=freebsd
 
715
    ;;
 
716
  solaris*)
 
717
    host_os_def=solaris
 
718
    ;;
 
719
  *)
 
720
    EXTRA_CXX_LDFLAGS="-rdynamic"
 
721
    host_os_def=unknown
 
722
   ;;
 
723
esac
 
724
TS_ADDTO(CPPFLAGS, [-D$host_os_def])
 
725
 
 
726
#
 
727
# _Here_ is where we go ahead and add the _optimizations_ to already
 
728
#  existing CFLAGS/CXXFLAGS if some special values had been set.
 
729
#
 
730
if test "x${enable_debug}" = "xyes"; then
 
731
  TS_ADDTO(CFLAGS, [${cc_oflag_dbg}])
 
732
  TS_ADDTO(CXXFLAGS, [${cxx_oflag_dbg}])
 
733
  TS_ADDTO(CPPFLAGS, [-DDEBUG -D_DEBUG])
 
734
else
 
735
  TS_ADDTO(CFLAGS, [${cc_oflag_opt}])
 
736
  TS_ADDTO(CXXFLAGS, [${cxx_oflag_opt}])
 
737
fi
 
738
 
 
739
#
 
740
# Note:  These are site-specific macro's that do various tests
 
741
#         on the selected compilers.  There was some tunning
 
742
#         associated with our not wanting to use GNU for _everything_.
 
743
# Note:  This macro may set certain parameters when run.
 
744
#
 
745
 
 
746
 
 
747
# -----------------------------------------------------------------------------
 
748
# 4. CHECK FOR LIBRARIES
 
749
 
 
750
AC_CHECK_LIB([m],[sin],[AC_SUBST([LIBM],["-lm"])])
 
751
AC_CHECK_LIB([exc],[exc_capture_context],[AC_SUBST([LIBEXC],["-lexc"])])
 
752
AC_CHECK_LIB([mld],[MLD_demangle_string],[AC_SUBST([LIBMLD],["-lmld"])])
 
753
AC_CHECK_LIB([dl],[dlopen],[AC_SUBST([LIBDL],["-ldl"])])
 
754
AC_CHECK_LIB([socket],[socket],[AC_SUBST([LIBSOCKET],["-lsocket"])])
 
755
AC_CHECK_LIB([nsl],[gethostbyname],[AC_SUBST([LIBNSL],["-lnsl"])])
 
756
AC_CHECK_LIB([resolv],[res_init],[AC_SUBST([LIBRESOLV],["-lresolv"])])
 
757
AC_CHECK_LIB([resolv],[__putlong],[AC_SUBST([LIBRESOLV],["-lresolv"])])
 
758
AC_CHECK_LIB([pthread],[pthread_exit],[AC_SUBST([LIBTHREAD],["-lpthread"])])
 
759
AC_CHECK_LIB([rt],[clock_gettime],[AC_SUBST([LIBRT],["-lrt"])])
 
760
AC_CHECK_LIB([posix4],[clock_gettime],[AC_SUBST([LIBRT],["-lposix4"])])
 
761
AC_CHECK_LIB([iconv],[iconv_open],[AC_SUBST([LIBICONV],["-liconv"])])
 
762
AC_CHECK_LIB([iconv],[libiconv_open],[AC_SUBST([LIBICONV],["-liconv"])])
 
763
# TODO: We have --enable-libev but here we add it unconditionally
 
764
#       making resulting binaries always linked to libev if present.
 
765
#       Use a proper --with-libev and fail on --enable-libev and -lev
 
766
#       is missing. Allow --with-libev=builtin? living in ./srclib/ev ?
 
767
#
 
768
AC_CHECK_LIB([ev],[ev_sleep],[AC_SUBST([LIBEV],["-lev"])])
 
769
 
 
770
#
 
771
# Check for SSL presence and usability
 
772
TS_CHECK_CRYPTO
 
773
if test "x${enable_crypto}" != "xyes"; then
 
774
  AC_MSG_ERROR([Need at least one SSL library, --with-openssl is supported])
 
775
fi
 
776
 
 
777
#
 
778
# Check for zlib presence and usability
 
779
TS_CHECK_ZLIB
 
780
 
 
781
#
 
782
# Check for lzma presence and usability
 
783
TS_CHECK_LZMA
 
784
 
 
785
#
 
786
# Tcl macros provided by m4/tcl.m4
 
787
#
 
788
# this will error out if tclConfig.sh is not found
 
789
SC_PATH_TCLCONFIG
 
790
 
 
791
# if tclConfig.sh loads properly, assume libraries are there and working
 
792
SC_LOAD_TCLCONFIG
 
793
 
 
794
# expect tclConfig.sh to populate TCL_LIB_FLAG and TCL_INCLUDE_SPEC
 
795
case $host_os in
 
796
  darwin*)
 
797
    TCL_LIB_FLAG="-ltcl" # OSX fails to populate this variable
 
798
    ;;
 
799
  *)
 
800
   ;;
 
801
esac
 
802
AC_SUBST([LIBTCL],[$TCL_LIB_FLAG])
 
803
 
 
804
case $host_os in
 
805
  freebsd*)
 
806
    TS_ADDTO(CPPFLAGS, [-I/usr/local/include])
 
807
    ;;
 
808
  solaris*)
 
809
    TS_ADDTO(CPPFLAGS, [-I/usr/local/include])
 
810
    ;;
 
811
esac
 
812
 
 
813
if test "x${TCL_INCLUDE_SPEC}" != "x-I/usr/include"; then
 
814
   TS_ADDTO(CPPFLAGS, [$TCL_INCLUDE_SPEC])
 
815
fi
 
816
 
 
817
#
 
818
# Check for XML parser
 
819
#
 
820
TS_CHECK_XML
 
821
if test "x${enable_xml}" != "xyes"; then
 
822
  AC_MSG_ERROR([Need at least one XML library, --with-expat is supported])
 
823
fi
 
824
 
 
825
#
 
826
# Check for default sqlite3 DB backend
 
827
#
 
828
use_sqlite3=1
 
829
use_libdb=0
 
830
TS_CHECK_SQLITE3
 
831
if test "x${enable_sqlite3}" != "xyes"; then
 
832
  TS_CHECK_BDB
 
833
  if test "x${enable_libdb}" != "xyes"; then
 
834
    AC_MSG_ERROR([Need at least one DB backend, --with-sqlite3 and --with-libdb are supported])
 
835
  fi
 
836
  use_sqlite3=0
 
837
  use_libdb=1
 
838
fi
 
839
AC_SUBST(use_sqlite3)
 
840
AC_SUBST(use_libdb)
 
841
 
 
842
TS_FLAG_FUNCS([clock_gettime kqueue epoll_ctl posix_memalign posix_fadvise lrand48_r srand48_r port_create])
 
843
TS_FLAG_FUNCS([strndup strlcpy strlcat])
 
844
 
 
845
AC_SUBST(has_clock_gettime)
 
846
AC_SUBST(has_posix_memalign)
 
847
AC_SUBST(has_posix_fadvise)
 
848
AC_SUBST(has_lrand48_r)
 
849
AC_SUBST(has_srand48_r)
 
850
AC_SUBST(has_strndup)
 
851
AC_SUBST(has_strlcpy)
 
852
AC_SUBST(has_strlcat)
 
853
 
 
854
# Check for eventfd() and sys/eventfd.h (both must exist ...)
 
855
TS_FLAG_HEADERS([sys/eventfd.h], [has_eventfd=1], [has_eventfd=0], [])
 
856
if test "x${has_eventfd}" = "xyes"; then
 
857
  AS_IF([test "x$enable_eventfd" = "xyes"],
 
858
    [TS_FLAG_FUNCS([eventfd])]
 
859
  )
 
860
fi
 
861
AC_SUBST(has_eventfd)
 
862
 
 
863
#
 
864
# Check for pcre library
 
865
#
 
866
TS_CHECK_PCRE
 
867
if test "x${enable_pcre}" != "xyes"; then
 
868
  AC_MSG_ERROR([Cannot find pcre library. Configure --with-pcre=DIR])
 
869
fi
 
870
 
 
871
has_backtrace=0
 
872
# Check for backtrace() support
 
873
TS_FLAG_HEADERS([execinfo.h], [has_backtrace=1],[])
 
874
if test "${has_backtrace}" = "1"; then
 
875
  # FreeBSD requires '/usr/ports/devel/libexecinfo' for gdb style backtrace() support
 
876
  AC_CHECK_LIB([execinfo], [backtrace], [have_backtrace_lib=yes
 
877
                                         AC_SUBST([LIBEXECINFO],["-lexecinfo"])])
 
878
  if test "x${have_backtrace_lib}" = "xyes"; then
 
879
    AC_MSG_NOTICE([Using backtrace library '-lexecinfo'])
 
880
  fi
 
881
else
 
882
  AC_MSG_WARN([No backtrace() support found])
 
883
fi
 
884
AC_SUBST(execinfoh)
 
885
AC_SUBST(has_backtrace)
 
886
 
 
887
use_libev=0
 
888
use_epoll=0
 
889
use_kqueue=0
 
890
use_port=0
 
891
if test "x$enable_libev" = "xyes"; then
 
892
  use_libev=1
 
893
  have_good_poller=1
 
894
elif test "$ac_cv_func_epoll_ctl" = "yes"; then
 
895
  use_epoll=1
 
896
  have_good_poller=1
 
897
  AC_MSG_NOTICE([Using epoll event interface])
 
898
elif test "$ac_cv_func_kqueue" = "yes"; then
 
899
  use_kqueue=1
 
900
  have_good_poller=1
 
901
  AC_MSG_NOTICE([Using kqueue event interface])
 
902
elif test "$ac_cv_func_port_create" = "yes"; then
 
903
  use_port=1
 
904
  have_good_poller=1
 
905
  AC_MSG_NOTICE([Using port event interface])
 
906
else
 
907
  AC_MSG_FAILURE([No suitable polling interface found])
 
908
fi
 
909
AC_SUBST(use_libev)
 
910
AC_SUBST(use_epoll)
 
911
AC_SUBST(use_kqueue)
 
912
AC_SUBST(use_port)
 
913
 
 
914
has_profiler=0
 
915
if test "x${with_profiler}" = "xyes"; then
 
916
  AC_CHECK_LIB([profiler], [ProfilerStart],
 
917
    [AC_SUBST([LIBPROFILER], ["-lprofiler"])
 
918
     has_profiler=1
 
919
    ],
 
920
    [AC_MSG_FAILURE([check for profiler failed. Have you installed google-perftools-devel?])],
 
921
  )
 
922
fi
 
923
AC_SUBST(has_profiler)
 
924
 
 
925
has_demangle=0
 
926
# For SunPro 5.2 - we need the demangle symbol for
 
927
#  ink_stack_trace.cc in lib/ts.  Because this
 
928
#  library is part of the SunPro distribution, we need
 
929
#  check with the C++ compiler since we might be using
 
930
#  SunPro CC for the C++ compiler and gcc for the C compiler
 
931
AC_LANG_PUSH([C++])
 
932
AC_CHECK_LIB([demangle],[cplus_demangle],
 
933
  [LIBDEMANGLE="-ldemangle"
 
934
   has_demangle=1
 
935
  ]
 
936
)
 
937
AC_SUBST([LIBDEMANGLE])
 
938
AC_LANG_POP
 
939
AC_SUBST(has_demangle)
 
940
 
 
941
need_union_semun=0
 
942
# It's stupid, but not all platforms have union semun, even those that need it.
 
943
AC_MSG_CHECKING(for union semun in sys/sem.h)
 
944
AC_TRY_COMPILE([
 
945
#include <sys/types.h>
 
946
#include <sys/ipc.h>
 
947
#include <sys/sem.h>
 
948
],[
 
949
union semun arg;
 
950
semctl(0, 0, 0, arg);
 
951
], [union_semun=yes]
 
952
msg=yes, [
 
953
need_union_semun="1"
 
954
msg=no ] )
 
955
AC_MSG_RESULT([$msg])
 
956
 
 
957
AC_SUBST(need_union_semun)
 
958
 
 
959
# Check for POSIX capabilities library.
 
960
# If we don't find it, disable checking for header.
 
961
use_posix_cap=0
 
962
AS_IF([test "x$enable_posix_cap" = "xyes"],
 
963
  AC_CHECK_LIB([cap],[cap_set_proc],
 
964
    [AC_SUBST([LIBCAP], ["-lcap"])
 
965
     use_posix_cap=1
 
966
    ],
 
967
    [enable_posix_cap=no]
 
968
  )
 
969
)
 
970
AC_SUBST(use_posix_cap)
 
971
# -----------------------------------------------------------------------------
 
972
# 5. CHECK FOR HEADER FILES
 
973
 
 
974
TS_FLAG_HEADERS([sys/epoll.h \
 
975
                  sys/event.h \
 
976
                  machine/endian.h \
 
977
                  endian.h \
 
978
                  sys/sysinfo.h \
 
979
                  sys/sysctl.h \
 
980
                  sys/systeminfo.h \
 
981
                  netinet/in.h \
 
982
                  netinet/in_systm.h \
 
983
                  netinet/tcp.h \
 
984
                  sys/ioctl.h \
 
985
                  sys/byteorder.h \
 
986
                  sys/sockio.h \
 
987
                  arpa/inet.h \
 
988
                  arpa/nameser.h \
 
989
                  arpa/nameser_compat.h \
 
990
                  execinfo.h \
 
991
                  netdb.h \
 
992
                  ctype.h \
 
993
                  siginfo.h \
 
994
                  malloc.h \
 
995
                  wait.h \
 
996
                  float.h \
 
997
                  libgen.h \
 
998
                  values.h \
 
999
                  alloca.h \
 
1000
                  cpio.h \
 
1001
                  stropts.h \
 
1002
                  sys/mount.h \
 
1003
                  sys/param.h \
 
1004
                  sys/sysmacros.h \
 
1005
                  math.h \
 
1006
                  stdint.h \
 
1007
                  net/ppp_defs.h])
 
1008
 
 
1009
AC_SUBST(sys_epollh)
 
1010
AC_SUBST(sys_eventh)
 
1011
AC_SUBST(machine_endianh)
 
1012
AC_SUBST(endianh)
 
1013
AC_SUBST(netinet_inh)
 
1014
AC_SUBST(netinet_in_systmh)
 
1015
AC_SUBST(netinet_tcph)
 
1016
AC_SUBST(sys_ioctlh)
 
1017
AC_SUBST(sys_byteorderh)
 
1018
AC_SUBST(sys_sockioh)
 
1019
AC_SUBST(sys_sysctlh)
 
1020
AC_SUBST(sys_sysinfoh)
 
1021
AC_SUBST(sys_systeminfoh)
 
1022
AC_SUBST(arpa_ineth)
 
1023
AC_SUBST(arpa_nameserh)
 
1024
AC_SUBST(arpa_nameser_compath)
 
1025
AC_SUBST(execinfoh)
 
1026
AC_SUBST(netdbh)
 
1027
AC_SUBST(ctypeh)
 
1028
 
 
1029
AC_SUBST(siginfoh)
 
1030
AC_SUBST(malloch)
 
1031
AC_SUBST(waith)
 
1032
AC_SUBST(floath)
 
1033
AC_SUBST(libgenh)
 
1034
AC_SUBST(valuesh)
 
1035
AC_SUBST(allocah)
 
1036
AC_SUBST(cpioh)
 
1037
AC_SUBST(stroptsh)
 
1038
AC_SUBST(sys_mounth)
 
1039
AC_SUBST(sys_paramh)
 
1040
AC_SUBST(sys_sysmacrosh)
 
1041
AC_SUBST(mathh)
 
1042
AC_SUBST(net_ppp_defsh)
 
1043
 
 
1044
TS_FLAG_HEADERS([netinet/ip.h], [], [],
 
1045
                 [[#ifdef HAVE_SYS_TYPES_H
 
1046
                    #include <sys/types.h>
 
1047
                   #endif
 
1048
                   #ifdef HAVE_NETINET_IN_H
 
1049
                    #include <netinet/in.h>
 
1050
                   #endif
 
1051
                 ]])
 
1052
 
 
1053
TS_FLAG_HEADERS([netinet/ip_icmp.h], [], [],
 
1054
                 [[#ifdef HAVE_SYS_TYPES_H
 
1055
                    #include <sys/types.h>
 
1056
                   #endif
 
1057
                   #ifdef HAVE_NETINET_IN_H
 
1058
                    #include <netinet/in.h>
 
1059
                   #endif
 
1060
                   #ifdef HAVE_NETINET_IP_H
 
1061
                    #include <netinet/ip.h>
 
1062
                   #endif
 
1063
                   #ifdef HAVE_NETINET_IN_SYSTM_H
 
1064
                    #include <netinet/in_systm.h>
 
1065
                   #endif
 
1066
                 ]])
 
1067
 
 
1068
AC_SUBST(netinet_iph)
 
1069
AC_SUBST(netinet_ip_icmph)
 
1070
 
 
1071
if test "x${with_profiler}" = "xyes"; then
 
1072
TS_FLAG_HEADERS([google/profiler.h \
 
1073
                  ], [], [])
 
1074
fi
 
1075
 
 
1076
if test "x${enable_posix_cap}" = "xyes"; then
 
1077
  AC_CHECK_HEADERS([sys/capability.h],
 
1078
    [],
 
1079
    [AC_MSG_FAILURE([POSIX capabilities header not found. Try --disable-posix-cap])],
 
1080
    []
 
1081
  )
 
1082
fi
 
1083
 
 
1084
#
 
1085
# Configure sockopt value for TPROXY. Look at the enable flag.
 
1086
# Value 'no' means user forced disable, don't check anything else.
 
1087
#       'auto' means user didn't say, so silently enable/disable
 
1088
#              based on success.
 
1089
#       A numeric value means enable, don't check, use that value.
 
1090
#       Anything else means user forced, fail if value not found
 
1091
#       in header file.
 
1092
# We can't just include linux/in.h because it's incompatible with
 
1093
# netinet/in.h.
 
1094
# Verify the file exists (is readable), scan for the value we need,
 
1095
# if found export the value and enable use of the value.
 
1096
#
 
1097
ip_transparent=0
 
1098
use_tproxy=0
 
1099
tproxy_header=/usr/include/linux/in.h
 
1100
tproxy_usage_enable="
 
1101
    --enable-tproxy Enable the feature and validate."
 
1102
tproxy_usage_default="
 
1103
    --enable-tproxy=force Enable using default sockopt value, no validation."
 
1104
tproxy_usage_numeric="
 
1105
    --enable-tproxy=X where X is numeric
 
1106
                      Enable, use X for sockopt value, no validation."
 
1107
tproxy_usage_disable="
 
1108
    --disable-tproxy Disable feature, no validation."
 
1109
proxy_usage="$tproxy_usage_enable$tproxy_usage_default$tproxy_usage_numeric$tproxy_usage_disable"
 
1110
 
 
1111
AS_IF([test "x$enable_tproxy" != "xno"], [
 
1112
  AS_IF([test "x${enable_posix_cap}" != "xyes"], [
 
1113
    AS_IF([test "x$enable_tproxy" = xauto], [
 
1114
      AC_MSG_RESULT([no])
 
1115
    ],[
 
1116
      AC_MSG_FAILURE([TPROXY feature requires POSIX capabilities.])
 
1117
    ])
 
1118
  ],[
 
1119
    AC_MSG_CHECKING([for TPROXY sockopt IP_TRANSPARENT])
 
1120
    case "$enable_tproxy" in
 
1121
      [[0-9][0-9]*])
 
1122
        ip_transparent=$enable_tproxy
 
1123
        use_tproxy=1
 
1124
        AC_MSG_RESULT([forced to $ip_transparent])
 
1125
        ;;
 
1126
      force)
 
1127
        ip_transparent=19
 
1128
        use_tproxy=1
 
1129
        AC_MSG_RESULT([forced to $ip_transparent])
 
1130
        ;;
 
1131
      yes|auto)
 
1132
        AS_IF([test -r $tproxy_header], [
 
1133
          ip_transparent=`$AWK "/^#define[ \t]+IP_TRANSPARENT[ \t]+[0-9]+/{print \\$3}" $tproxy_header`
 
1134
          AS_IF([test "x$ip_transparent" != "x"], [
 
1135
            use_tproxy=1
 
1136
            AC_MSG_RESULT([set to $ip_transparent])
 
1137
          ],[
 
1138
            ip_transparent=0
 
1139
            AS_IF([test "x$enable_tproxy" = xauto], [
 
1140
             AC_MSG_RESULT([no])
 
1141
            ],[
 
1142
              AC_MSG_RESULT([failed])
 
1143
              AC_MSG_FAILURE([tproxy feature enabled but the sockopt value was not found in $tproxy_header. Try one of$tproxy_usage_default$tproxy_usage_numeric$tproxy_usage_disable])
 
1144
            ])
 
1145
          ])
 
1146
        ],[
 
1147
          AS_IF([test "x$enable_tproxy" = xauto], [
 
1148
            AC_MSG_RESULT([no])
 
1149
          ],[
 
1150
            AC_MSG_RESULT([failed])
 
1151
            AC_MSG_FAILURE([tproxy feature enabled but the header file $tproxy_header was not readable. Try one of$tproxy_usage_default$tproxy_usage_numeric$tproxy_usage_disable])
 
1152
          ])
 
1153
        ])
 
1154
        ;;
 
1155
      *)
 
1156
        AC_MSG_RESULT([failed])
 
1157
        AC_MSG_FAILURE([Invalid argument to feature tproxy.$tproxy_usage])
 
1158
        ;;
 
1159
      esac
 
1160
  ])
 
1161
])
 
1162
 
 
1163
AC_SUBST(use_tproxy)
 
1164
AC_SUBST(ip_transparent)
 
1165
 
 
1166
TS_CHECK_DEFAULT_IFACE
 
1167
TS_CHECK_GETHOSTBYNAME_R_STYLE
 
1168
 
 
1169
#
 
1170
# use modular IOCORE
 
1171
#
 
1172
iocore_include_dirs="-I\$(top_srcdir)/iocore/eventsystem \
 
1173
-I\$(top_srcdir)/iocore/net \
 
1174
-I\$(top_srcdir)/iocore/aio \
 
1175
-I\$(top_srcdir)/iocore/hostdb \
 
1176
-I\$(top_srcdir)/iocore/cache \
 
1177
-I\$(top_srcdir)/iocore/cluster \
 
1178
-I\$(top_srcdir)/iocore/utils \
 
1179
-I\$(top_srcdir)/iocore/dns"
 
1180
 
 
1181
if test "x$enable_libev" = "xyes"; then
 
1182
   iocore_include_dirs="${iocore_include_dirs} -I\$(top_srcdir)/libev"
 
1183
fi
 
1184
 
 
1185
# Testing Framework suffix generation hack
 
1186
TFW_PACKAGE_SUFFIX=$os_type
 
1187
 
 
1188
MGMT_DEFS="$MGMT_DEFS -DMGMT_USE_SYSLOG"
 
1189
 
 
1190
AC_MSG_NOTICE([Build using CC=$CC])
 
1191
AC_MSG_NOTICE([Build using CXX=$CXX])
 
1192
AC_MSG_NOTICE([Build using CPP=$CPP])
 
1193
AC_MSG_NOTICE([Build using CCAS=$CCAS])
 
1194
AC_MSG_NOTICE([Build using CFLAGS=$CFLAGS])
 
1195
AC_MSG_NOTICE([Build using SHARED_CFLAGS=$SHARED_CFLAGS])
 
1196
AC_MSG_NOTICE([Build using CXXFLAGS=$CXXFLAGS])
 
1197
AC_MSG_NOTICE([Build using SHARED_CXXFLAGS=$SHARED_CXXFLAGS])
 
1198
AC_MSG_NOTICE([Build using SHARED_CXXLINKFLAGS=$SHARED_LINKCXXFLAGS])
 
1199
AC_MSG_NOTICE([Build using CPPFLAGS=$CPPFLAGS])
 
1200
AC_MSG_NOTICE([Build using CCASFLAGS=$CCASFLAGS])
 
1201
AC_MSG_NOTICE([Build using LDFLAGS=$LDFLAGS])
 
1202
AC_MSG_NOTICE([Build using SHARED_LDFLAGS=$SHARED_LDFLAGS])
 
1203
AC_MSG_NOTICE([Build using EXTRA_CC_LDFLAGS=$EXTRA_CC_LDFLAGS])
 
1204
AC_MSG_NOTICE([Build using EXTRA_CXX_LDFLAGS=$EXTRA_CXX_LDFLAGS])
 
1205
AC_MSG_NOTICE([Build using MGMT_DEFS=$MGMT_DEFS])
 
1206
AC_MSG_NOTICE([Build using API_DEFS=$API_DEFS])
 
1207
 
 
1208
AC_SUBST([API_DEFS])
 
1209
AC_SUBST([CC])
 
1210
AC_SUBST([CFLAGS])
 
1211
AC_SUBST([CXX])
 
1212
AC_SUBST([CXXFLAGS])
 
1213
AC_SUBST([EXPAT_LDFLAGS])
 
1214
AC_SUBST([EXTRA_CC_LDFLAGS])
 
1215
AC_SUBST([EXTRA_CXX_LDFLAGS])
 
1216
AC_SUBST([iocore_include_dirs])
 
1217
AC_SUBST([LDFLAGS])
 
1218
AC_SUBST([MGMT_DEFS])
 
1219
AC_SUBST([SHARED_CFLAGS])
 
1220
AC_SUBST([SHARED_CXXFLAGS])
 
1221
AC_SUBST([SHARED_CXXLINKFLAGS])
 
1222
AC_SUBST([SHARED_LDFLAGS])
 
1223
AC_SUBST([TFW_PACKAGE_SUFFIX])
 
1224
 
 
1225
# -----------------------------------------------------------------------------
 
1226
# 6. OUTPUT FILES
 
1227
 
 
1228
AC_CONFIG_FILES([lib/ts/ink_config.h proxy/api/ts/ts.h])
 
1229
AC_CONFIG_FILES([tsxs])
 
1230
AC_CONFIG_FILES([doc/Doxyfile])
 
1231
AC_CONFIG_FILES([doc/Makefile])
 
1232
AC_CONFIG_FILES([rc/Makefile])
 
1233
AC_CONFIG_FILES([rc/trafficserver])
 
1234
AC_CONFIG_FILES([iocore/aio/Makefile])
 
1235
AC_CONFIG_FILES([iocore/cache/Makefile])
 
1236
AC_CONFIG_FILES([iocore/cluster/Makefile])
 
1237
AC_CONFIG_FILES([iocore/dns/Makefile])
 
1238
AC_CONFIG_FILES([iocore/eventsystem/Makefile])
 
1239
AC_CONFIG_FILES([iocore/hostdb/Makefile])
 
1240
AC_CONFIG_FILES([iocore/Makefile])
 
1241
AC_CONFIG_FILES([iocore/net/Makefile])
 
1242
AC_CONFIG_FILES([iocore/utils/Makefile])
 
1243
AC_CONFIG_FILES([lib/Makefile])
 
1244
AC_CONFIG_FILES([lib/ts/Makefile])
 
1245
AC_CONFIG_FILES([lib/records/Makefile])
 
1246
AC_CONFIG_FILES([lib/tsconfig/Makefile])
 
1247
AC_CONFIG_FILES([Makefile])
 
1248
AC_CONFIG_FILES([proxy/config/body_factory/default/Makefile])
 
1249
AC_CONFIG_FILES([proxy/config/body_factory/Makefile])
 
1250
AC_CONFIG_FILES([proxy/config/records.config proxy/config/storage.config])
 
1251
AC_CONFIG_FILES([proxy/config/Makefile])
 
1252
AC_CONFIG_FILES([proxy/congest/Makefile])
 
1253
AC_CONFIG_FILES([proxy/hdrs/Makefile])
 
1254
AC_CONFIG_FILES([proxy/http2/Makefile])
 
1255
AC_CONFIG_FILES([proxy/http2/remap/Makefile])
 
1256
AC_CONFIG_FILES([proxy/logging/Makefile])
 
1257
AC_CONFIG_FILES([proxy/Makefile])
 
1258
AC_CONFIG_FILES([proxy/mgmt2/api2/Makefile])
 
1259
AC_CONFIG_FILES([proxy/mgmt2/api2/remote/Makefile])
 
1260
AC_CONFIG_FILES([proxy/mgmt2/cli2/Makefile])
 
1261
AC_CONFIG_FILES([proxy/mgmt2/cli/Makefile])
 
1262
AC_CONFIG_FILES([proxy/mgmt2/cluster/Makefile])
 
1263
AC_CONFIG_FILES([proxy/mgmt2/cop/Makefile])
 
1264
AS_IF([test "x$enable_webui" = "xyes"],
 
1265
  [AC_CONFIG_FILES([proxy/mgmt2/html2/Makefile])
 
1266
   AC_CONFIG_FILES([proxy/mgmt2/html2/agent-installer/Makefile])
 
1267
   AC_CONFIG_FILES([proxy/mgmt2/html2/charting/Makefile])
 
1268
   AC_CONFIG_FILES([proxy/mgmt2/html2/configure/Makefile])
 
1269
   AC_CONFIG_FILES([proxy/mgmt2/html2/configure/helper/Makefile])
 
1270
   AC_CONFIG_FILES([proxy/mgmt2/html2/images/Makefile])
 
1271
   AC_CONFIG_FILES([proxy/mgmt2/html2/include/Makefile])
 
1272
   AC_CONFIG_FILES([proxy/mgmt2/html2/monitor/Makefile])
 
1273
   AC_CONFIG_FILES([proxy/mgmt2/html2/mrtg/Makefile])
 
1274
   AC_CONFIG_FILES([proxy/mgmt2/html2/tune/Makefile])
 
1275
])
 
1276
AC_CONFIG_FILES([proxy/mgmt2/Makefile])
 
1277
AC_CONFIG_FILES([proxy/mgmt2/preparse/Makefile])
 
1278
AC_CONFIG_FILES([proxy/mgmt2/stats/Makefile])
 
1279
AC_CONFIG_FILES([proxy/mgmt2/tools/Makefile])
 
1280
AC_CONFIG_FILES([proxy/mgmt2/utils/Makefile])
 
1281
AC_CONFIG_FILES([proxy/mgmt2/web2/Makefile])
 
1282
AC_CONFIG_FILES([proxy/stats/Makefile])
 
1283
AC_CONFIG_FILES([proxy/wccp/Makefile])
 
1284
AC_CONFIG_FILES([proxy/api/ts/Makefile])
 
1285
# production plugins
 
1286
AC_CONFIG_FILES([plugins/Makefile])
 
1287
AC_CONFIG_FILES([plugins/conf_remap/Makefile])
 
1288
# example plugins
 
1289
AC_CONFIG_FILES([example/Makefile])
 
1290
AC_CONFIG_FILES([example/add-header/Makefile])
 
1291
AC_CONFIG_FILES([example/append-transform/Makefile])
 
1292
AC_CONFIG_FILES([example/basic-auth/Makefile])
 
1293
AC_CONFIG_FILES([example/blacklist-0/Makefile])
 
1294
AC_CONFIG_FILES([example/blacklist-1/Makefile])
 
1295
AC_CONFIG_FILES([example/bnull-transform/Makefile])
 
1296
AC_CONFIG_FILES([example/cache_scan/Makefile])
 
1297
AC_CONFIG_FILES([example/file-1/Makefile])
 
1298
AC_CONFIG_FILES([example/gzip-transform/Makefile])
 
1299
AC_CONFIG_FILES([example/hello/Makefile])
 
1300
AC_CONFIG_FILES([example/null-transform/Makefile])
 
1301
AC_CONFIG_FILES([example/output-header/Makefile])
 
1302
AC_CONFIG_FILES([example/prefetch/Makefile])
 
1303
AC_CONFIG_FILES([example/protocol/Makefile])
 
1304
AC_CONFIG_FILES([example/redirect-1/Makefile])
 
1305
AC_CONFIG_FILES([example/query_remap/Makefile])
 
1306
AC_CONFIG_FILES([example/remap/Makefile])
 
1307
AC_CONFIG_FILES([example/replace-header/Makefile])
 
1308
AC_CONFIG_FILES([example/response-header-1/Makefile])
 
1309
AC_CONFIG_FILES([example/server-transform/Makefile])
 
1310
AC_CONFIG_FILES([example/session-1/Makefile])
 
1311
AC_CONFIG_FILES([example/thread-1/Makefile])
 
1312
AC_CONFIG_FILES([example/thread-pool/Makefile])
 
1313
# example app w/ standalone iocore
 
1314
AC_CONFIG_FILES([example/app-template/Makefile example/app-template/records.config])
 
1315
 
 
1316
# -----------------------------------------------------------------------------
 
1317
# 7. autoheader TEMPLATES
 
1318
 
 
1319
AC_OUTPUT