forked from 3rdparty/libprocess
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
117 lines (92 loc) · 3.8 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# Generated with autoscan, then modified appropriately.
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.61])
AC_INIT([libprocess], [0.0.1])
# Have autoconf setup some variables related to the system.
AC_CANONICAL_HOST
AC_CANONICAL_BUILD
AC_CANONICAL_TARGET
AC_LANG([C++])
AC_CONFIG_MACRO_DIR([m4])
# Initialize automake.
# -Wno-portability, since we require GNU Make for % patterns.
AM_INIT_AUTOMAKE([-Wall -Werror -Wno-portability foreign])
# Required for linking non-POSIX libs.
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
# Initialize libtool (LT_OUTPUT builds ./libtool immediately, needed
# if we want to do tests with libtool during configuration).
LT_PREREQ([2.2])
LT_INIT
LT_LANG([C++])
LT_OUTPUT
# The default CFLAGS/CXXFLAGS from autoconf when using gcc usually
# includes "-O2". These really slow down compiling our tests, so we
# turn them off and enable them (where desired) directly in the
# Makefile. Note that this should not have an impact on users setting
# CFLAGS/CXXFLAGS directly at configure time, or when running make.
AS_IF([test "x${ac_cv_env_CFLAGS_set}" = "x"], [CFLAGS="-g"])
AS_IF([test "x${ac_cv_env_CXXFLAGS_set}" = "x"], [CXXFLAGS="-g"])
# Save the configure arguments so we can pass them to any third-party
# libraries that we might run configure on (see
# 3rdparty/Makefile.am). One downside of our strategy for shipping
# and building third-party libraries is that we can't expose options
# from nested third-party configure scripts.
CONFIGURE_ARGS="$ac_configure_args"
AC_SUBST(CONFIGURE_ARGS)
AC_CONFIG_SUBDIRS([3rdparty/stout])
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([3rdparty/Makefile])
AC_ARG_ENABLE([install],
AS_HELP_STRING([--enable-install],
[install libprocess]),
[AC_MSG_ERROR([libprocess can not currently be installed])])
AC_ARG_ENABLE([optimize],
AS_HELP_STRING([--disable-optimize],
[don't try to compile with optimizations]),
[], [enable_optimize=yes])
AC_ARG_ENABLE([perftools],
AS_HELP_STRING([--enable-perftools],
[enable google perftools]),
[gperftools=yes])
AC_ARG_WITH([zlib],
AS_HELP_STRING([--without-zlib],
[disables zlib compression, which means the webui
will be far less responsive; not recommended]),
[], [with_zlib=yes])
# Do some OS specific setup.
case "${target_os}" in
linux*)
LIBS="$LIBS -lrt" # For clock_gettime() in stout/stopwatch.hpp.
OS_NAME=linux # Used below for OS_LINUX.
;;
*)
;;
esac
# Checks for gcc toolchain (we rely on some atomic builtins for now).
AC_PROG_CXX([g++])
AC_PROG_CC([gcc])
# Check for pthreads (uses m4/acx_pthread.m4).
ACX_PTHREAD([], [AC_MSG_ERROR([failed to find pthreads])])
# Check if we should try and enable optimizations.
if test "x$enable_optimize" = "xyes"; then
# For now, we only turn on optimizations for gcc.
if test "x$GCC" = "xyes"; then
CXXFLAGS="$CXXFLAGS -g2 -O2"
fi
fi
# Check if we should/can build with libz.
if test "x$with_zlib" = "xyes"; then
AC_CHECK_LIB([z], [deflate, gzread, gzwrite, inflate], [],
[AC_MSG_ERROR([cannot find libz
-------------------------------------------------------------------
This means HTTP responses will be slower because we cannot use
compression; you probably want to download and install zlib, but
you can get away without it by doing --without-zlib.
-------------------------------------------------------------------
])])
fi
AM_CONDITIONAL([HAS_GPERFTOOLS], [test "x$gperftools" = "xyes"])
# Used for conditionally building source files (e.g., only want to
# build stout/tests/proc_tests.cpp on Linux).
AM_CONDITIONAL([OS_LINUX], [test "x$OS_NAME" = "xlinux"])
AC_OUTPUT