blob: 08513687f3496cdabd23c4bb3f9d88ad2bb48de1 [file] [log] [blame]
mmentovai7daf2462006-09-20 21:16:16 +00001# Copyright (c) 2006, Google Inc.
2# All rights reserved.
3#
4# Redistribution and use in source and binary forms, with or without
5# modification, are permitted provided that the following conditions are
6# met:
7#
8# * Redistributions of source code must retain the above copyright
9# notice, this list of conditions and the following disclaimer.
10# * Redistributions in binary form must reproduce the above
11# copyright notice, this list of conditions and the following disclaimer
12# in the documentation and/or other materials provided with the
13# distribution.
14# * Neither the name of Google Inc. nor the names of its
15# contributors may be used to endorse or promote products derived from
16# this software without specific prior written permission.
17#
18# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
mmentovai425d2562006-08-30 20:05:05 +000029
30
Mike Frysinger6cc03752017-02-06 15:10:13 -050031AC_PREREQ(2.64)
brynercb91a2f2006-08-25 21:14:45 +000032
thestig@chromium.org43e6db72010-11-08 19:49:41 +000033AC_INIT(breakpad, 0.1, google-breakpad-dev@googlegroups.com)
mmentovai425d2562006-08-30 20:05:05 +000034dnl Sanity check: the argument is just a file that should exist.
Mark Mentovaif74c85d2015-09-23 10:46:55 -040035AC_CONFIG_SRCDIR(README.md)
mmentovai425d2562006-08-30 20:05:05 +000036AC_CONFIG_AUX_DIR(autotools)
ted.mielczarek53a8b1a2010-08-31 15:09:01 +000037AC_CONFIG_MACRO_DIR([m4])
38AC_CANONICAL_HOST
mmentovai425d2562006-08-30 20:05:05 +000039
jimblandy71f75802010-02-11 19:31:48 +000040AM_INIT_AUTOMAKE(subdir-objects tar-ustar 1.11.1)
brynercb91a2f2006-08-25 21:14:45 +000041AM_CONFIG_HEADER(src/config.h)
ted.mielczarek@gmail.com07bb2312013-12-10 12:28:11 +000042AM_MAINTAINER_MODE
brynercb91a2f2006-08-25 21:14:45 +000043
Mike Frysingerf217ae42015-11-11 13:43:14 -050044AM_PROG_AR
digit@chromium.org7e3c5382012-08-31 18:38:29 +000045AM_PROG_AS
brynercb91a2f2006-08-25 21:14:45 +000046AC_PROG_CC
ted.mielczarekd192a712010-10-05 19:38:51 +000047AM_PROG_CC_C_O
brynercb91a2f2006-08-25 21:14:45 +000048AC_PROG_CPP
49AC_PROG_CXX
ted.mielczarekd192a712010-10-05 19:38:51 +000050AC_PROG_RANLIB
brynercb91a2f2006-08-25 21:14:45 +000051
vapier@chromium.org302124a2013-12-10 06:28:08 +000052dnl This must come before all the feature tests below.
53AC_ARG_ENABLE(m32,
54 AS_HELP_STRING([--enable-m32],
55 [Compile/build with -m32]
56 [(default is no)]),
57 [case "${enableval}" in
58 yes)
59 CFLAGS="${CFLAGS} -m32"
60 CXXFLAGS="${CXXFLAGS} -m32"
61 usem32=true
62 ;;
63 no)
64 usem32=false
65 ;;
66 *)
67 AC_MSG_ERROR(bad value ${enableval} for --enable-m32)
68 ;;
69 esac],
70 [usem32=false])
71
brynercb91a2f2006-08-25 21:14:45 +000072AC_HEADER_STDC
vapier@chromium.org302124a2013-12-10 06:28:08 +000073AC_SYS_LARGEFILE
nealsidde545c02010-03-02 00:39:48 +000074AX_PTHREAD
Gabriele Sveltoa9fca582017-04-11 11:51:28 +020075AC_CHECK_HEADERS([a.out.h sys/random.h])
Michael Forneye780d582020-03-16 12:56:56 -070076AC_CHECK_FUNCS([arc4random getcontext getrandom])
77AM_CONDITIONAL([HAVE_GETCONTEXT], [test "x$ac_cv_func_getcontext" = xyes])
nealsidde545c02010-03-02 00:39:48 +000078
Lei Zhang728bcdf2016-01-08 00:27:48 -080079AX_CXX_COMPILE_STDCXX(11, noext, mandatory)
80
Mike Frysinger6cc03752017-02-06 15:10:13 -050081dnl Test supported warning flags.
82WARN_CXXFLAGS=
83dnl This warning flag is used by clang. Its default behavior is to warn when
84dnl given an unknown flag rather than error out.
85AC_LANG_PUSH([C++])
86AX_CHECK_COMPILE_FLAG([-Werror=unknown-warning-option],[
87 ax_compiler_flags_test="-Werror=unknown-warning-option"
88],[
89 ax_compiler_flags_test=""
90])
91AX_APPEND_COMPILE_FLAGS(m4_flatten([
92 -Wmissing-braces
93 -Wnon-virtual-dtor
94 -Woverloaded-virtual
95 -Wreorder
96 -Wsign-compare
Tobias Sargeantb37547b2017-03-24 12:51:47 +000097 -Wunused-local-typedefs
Mike Frysinger6cc03752017-02-06 15:10:13 -050098 -Wunused-variable
99 -Wvla
100]), [WARN_CXXFLAGS], [${ax_compiler_flags_test}])
101AS_VAR_APPEND([WARN_CXXFLAGS], " -Werror")
102AC_LANG_POP([C++])
103AC_SUBST([WARN_CXXFLAGS])
104
Lars Volkerffe3e472017-05-10 22:50:32 +0200105dnl Test support for O_CLOEXEC
106AX_CHECK_DEFINE([fcntl.h], [O_CLOEXEC], [],
107 [AC_DEFINE([O_CLOEXEC], [0], [Fallback definition for old systems])])
108
ted.mielczarek53a8b1a2010-08-31 15:09:01 +0000109# Only build Linux client libs when compiling for Linux
110case $host in
digit@chromium.org62d486b2012-08-21 14:34:48 +0000111 *-*-linux* | *-android* )
112 LINUX_HOST=true
113 ;;
ted.mielczarek53a8b1a2010-08-31 15:09:01 +0000114esac
115AM_CONDITIONAL(LINUX_HOST, test x$LINUX_HOST = xtrue)
116
digit@chromium.org62d486b2012-08-21 14:34:48 +0000117# Only use Android support headers when compiling for Android
118case $host in
119 *-android*)
120 ANDROID_HOST=true
121 ;;
122esac
123AM_CONDITIONAL(ANDROID_HOST, test x$ANDROID_HOST = xtrue)
124
Mike Frysinger3f736ce2016-01-27 16:45:21 -0500125# Some tools (like mac ones) only support x86 currently.
126case $host_cpu in
127 i?86|x86_64)
128 X86_HOST=true
129 ;;
130esac
131AM_CONDITIONAL(X86_HOST, test x$X86_HOST = xtrue)
132
ted.mielczareke574a2a2010-10-05 19:38:22 +0000133AC_ARG_ENABLE(processor,
134 AS_HELP_STRING([--disable-processor],
135 [Don't build processor library]
136 [(default is no)]),
137 [case "${enableval}" in
138 yes)
139 disable_processor=false
140 ;;
141 no)
142 disable_processor=true
143 ;;
144 *)
145 AC_MSG_ERROR(bad value ${enableval} for --disable-processor)
146 ;;
147 esac],
148 [disable_processor=false])
149AM_CONDITIONAL(DISABLE_PROCESSOR, test x$disable_processor = xtrue)
150
ted.mielczarekdbf409c2011-02-28 14:05:22 +0000151AC_ARG_ENABLE(tools,
152 AS_HELP_STRING([--disable-tools],
153 [Don't build tool binaries]
154 [(default is no)]),
155 [case "${enableval}" in
156 yes)
157 disable_tools=false
158 ;;
159 no)
160 disable_tools=true
161 ;;
162 *)
163 AC_MSG_ERROR(bad value ${enableval} for --disable-tools)
164 ;;
165 esac],
166 [disable_tools=false])
167AM_CONDITIONAL(DISABLE_TOOLS, test x$disable_tools = xtrue)
168
169if test x$LINUX_HOST = xfalse -a x$disable_processor = xtrue -a x$disable_tools = xtrue; then
170 AC_MSG_ERROR([--disable-processor and --disable-tools were specified, and not building for Linux. Nothing to build!])
ted.mielczareke574a2a2010-10-05 19:38:22 +0000171fi
172
Mike Frysingerf820ead2016-01-25 19:27:56 -0500173AC_ARG_ENABLE(system-test-libs,
174 AS_HELP_STRING([--enable-system-test-libs],
175 [Use gtest/gmock/etc... from the system instead ]
176 [of the local copies (default is local)]),
177 [case "${enableval}" in
178 yes)
179 system_test_libs=true
180 ;;
181 no)
182 system_test_libs=false
183 ;;
184 *)
185 AC_MSG_ERROR(bad value ${enableval} for --enable-system-test-libs)
186 ;;
187 esac],
188 [system_test_libs=false])
189AM_CONDITIONAL(SYSTEM_TEST_LIBS, test x$system_test_libs = xtrue)
190
Mike Frysingerf820ead2016-01-25 19:27:56 -0500191AC_ARG_VAR([GMOCK_CFLAGS], [Compiler flags for gmock])
192AC_ARG_VAR([GMOCK_LIBS], [Linker flags for gmock])
Mike Frysingerf820ead2016-01-25 19:27:56 -0500193AC_ARG_VAR([GTEST_CFLAGS], [Compiler flags for gtest])
194AC_ARG_VAR([GTEST_LIBS], [Linker flags for gtest])
195if test x$system_test_libs = xtrue; then
Allen Webb488566d2019-06-14 13:06:07 -0700196 : "${GMOCK_CFLAGS:=-pthread}"
197 : "${GMOCK_LIBS:=-lgmock -lgtest -pthread -lpthread}"
198 : "${GTEST_CFLAGS:=-pthread}"
199 : "${GTEST_LIBS:=-lgtest -pthread -lpthread}"
Mike Frysingerf820ead2016-01-25 19:27:56 -0500200fi
201
mmentovai0dbedc92006-09-25 21:16:15 +0000202AC_ARG_ENABLE(selftest,
203 AS_HELP_STRING([--enable-selftest],
204 [Run extra tests with "make check" ]
205 [(may conflict with optimizations) ]
206 [(default is no)]),
207 [case "${enableval}" in
208 yes)
209 selftest=true
210 ;;
211 no)
212 selftest=false
213 ;;
214 *)
215 AC_MSG_ERROR(bad value ${enableval} for --enable-selftest)
216 ;;
217 esac],
218 [selftest=false])
219AM_CONDITIONAL(SELFTEST, test x$selftest = xtrue)
220
Ted Mielczarek2ecb2ba2016-10-24 15:16:28 -0400221AC_ARG_WITH(rust-demangle,
222 AS_HELP_STRING([--with-rust-demangle=/path/to/rust-demangle-capi],
223 [Link against the rust-demangle library]
224 [to demangle Rust language symbols during]
225 [symbol dumping (default is no)]
226 [Pass the path to the crate root.]),
227 [case "${withval}" in
228 yes)
229 AC_MSG_ERROR(You must pass the path to the rust-demangle-capi crate for --with-rust-demangle)
230 ;;
231 no)
232 rust_demangle=false
233 ;;
234 *)
235 if ! test -f "${withval}/Cargo.toml"; then
236 AC_MSG_ERROR(You must pass the path to the rust-demangle-capi crate for --with-rust-demangle)
237 fi
238 RUST_DEMANGLE_CFLAGS="-DHAVE_RUST_DEMANGLE -I${withval}/target/include"
239 RUST_DEMANGLE_LIBS="-L${withval}/target/release -lrust_demangle -lpthread -ldl"
240 ;;
241 esac],
242 [rust_demangle=false])
243AC_ARG_VAR([RUST_DEMANGLE_CFLAGS], [Compiler flags for rust-demangle])
244AC_ARG_VAR([RUST_DEMANGLE_LIBS], [Linker flags for rust-demangle])
245
Lars Volker49907e12018-01-31 13:29:11 -0800246AC_ARG_WITH(tests-as-root,
247 AS_HELP_STRING([--with-tests-as-root],
248 [Run the tests as root. Use this on platforms]
249 [like travis-ci.org that require root privileges]
250 [to use ptrace (default is no)]),
251 [case "${withval}" in
252 yes)
253 tests_as_root=true
254 ;;
255 no)
256 tests_as_root=false
257 ;;
258 *)
259 AC_MSG_ERROR(--with-tests-as-root can only be "yes" or "no")
260 ;;
261 esac],
262 [tests_as_root=false])
263AM_CONDITIONAL(TESTS_AS_ROOT, test x$tests_as_root = xtrue)
264
vapier@chromium.org1b309ed2014-08-27 02:10:55 +0000265AC_CONFIG_FILES(m4_flatten([
266 breakpad.pc
267 breakpad-client.pc
268 Makefile
269]))
270
brynercb91a2f2006-08-25 21:14:45 +0000271AC_OUTPUT