mmentovai | 7daf246 | 2006-09-20 21:16:16 +0000 | [diff] [blame] | 1 | # 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. |
mmentovai | 425d256 | 2006-08-30 20:05:05 +0000 | [diff] [blame] | 29 | |
| 30 | |
Mike Frysinger | 6cc0375 | 2017-02-06 15:10:13 -0500 | [diff] [blame] | 31 | AC_PREREQ(2.64) |
bryner | cb91a2f | 2006-08-25 21:14:45 +0000 | [diff] [blame] | 32 | |
thestig@chromium.org | 43e6db7 | 2010-11-08 19:49:41 +0000 | [diff] [blame] | 33 | AC_INIT(breakpad, 0.1, google-breakpad-dev@googlegroups.com) |
mmentovai | 425d256 | 2006-08-30 20:05:05 +0000 | [diff] [blame] | 34 | dnl Sanity check: the argument is just a file that should exist. |
Mark Mentovai | f74c85d | 2015-09-23 10:46:55 -0400 | [diff] [blame] | 35 | AC_CONFIG_SRCDIR(README.md) |
mmentovai | 425d256 | 2006-08-30 20:05:05 +0000 | [diff] [blame] | 36 | AC_CONFIG_AUX_DIR(autotools) |
ted.mielczarek | 53a8b1a | 2010-08-31 15:09:01 +0000 | [diff] [blame] | 37 | AC_CONFIG_MACRO_DIR([m4]) |
| 38 | AC_CANONICAL_HOST |
mmentovai | 425d256 | 2006-08-30 20:05:05 +0000 | [diff] [blame] | 39 | |
jimblandy | 71f7580 | 2010-02-11 19:31:48 +0000 | [diff] [blame] | 40 | AM_INIT_AUTOMAKE(subdir-objects tar-ustar 1.11.1) |
bryner | cb91a2f | 2006-08-25 21:14:45 +0000 | [diff] [blame] | 41 | AM_CONFIG_HEADER(src/config.h) |
ted.mielczarek@gmail.com | 07bb231 | 2013-12-10 12:28:11 +0000 | [diff] [blame] | 42 | AM_MAINTAINER_MODE |
bryner | cb91a2f | 2006-08-25 21:14:45 +0000 | [diff] [blame] | 43 | |
Mike Frysinger | f217ae4 | 2015-11-11 13:43:14 -0500 | [diff] [blame] | 44 | AM_PROG_AR |
digit@chromium.org | 7e3c538 | 2012-08-31 18:38:29 +0000 | [diff] [blame] | 45 | AM_PROG_AS |
bryner | cb91a2f | 2006-08-25 21:14:45 +0000 | [diff] [blame] | 46 | AC_PROG_CC |
ted.mielczarek | d192a71 | 2010-10-05 19:38:51 +0000 | [diff] [blame] | 47 | AM_PROG_CC_C_O |
bryner | cb91a2f | 2006-08-25 21:14:45 +0000 | [diff] [blame] | 48 | AC_PROG_CPP |
| 49 | AC_PROG_CXX |
ted.mielczarek | d192a71 | 2010-10-05 19:38:51 +0000 | [diff] [blame] | 50 | AC_PROG_RANLIB |
bryner | cb91a2f | 2006-08-25 21:14:45 +0000 | [diff] [blame] | 51 | |
vapier@chromium.org | 302124a | 2013-12-10 06:28:08 +0000 | [diff] [blame] | 52 | dnl This must come before all the feature tests below. |
| 53 | AC_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 | |
bryner | cb91a2f | 2006-08-25 21:14:45 +0000 | [diff] [blame] | 72 | AC_HEADER_STDC |
vapier@chromium.org | 302124a | 2013-12-10 06:28:08 +0000 | [diff] [blame] | 73 | AC_SYS_LARGEFILE |
nealsid | de545c0 | 2010-03-02 00:39:48 +0000 | [diff] [blame] | 74 | AX_PTHREAD |
Gabriele Svelto | a9fca58 | 2017-04-11 11:51:28 +0200 | [diff] [blame] | 75 | AC_CHECK_HEADERS([a.out.h sys/random.h]) |
Michael Forney | e780d58 | 2020-03-16 12:56:56 -0700 | [diff] [blame] | 76 | AC_CHECK_FUNCS([arc4random getcontext getrandom]) |
| 77 | AM_CONDITIONAL([HAVE_GETCONTEXT], [test "x$ac_cv_func_getcontext" = xyes]) |
nealsid | de545c0 | 2010-03-02 00:39:48 +0000 | [diff] [blame] | 78 | |
Lei Zhang | 728bcdf | 2016-01-08 00:27:48 -0800 | [diff] [blame] | 79 | AX_CXX_COMPILE_STDCXX(11, noext, mandatory) |
| 80 | |
Mike Frysinger | 6cc0375 | 2017-02-06 15:10:13 -0500 | [diff] [blame] | 81 | dnl Test supported warning flags. |
| 82 | WARN_CXXFLAGS= |
| 83 | dnl This warning flag is used by clang. Its default behavior is to warn when |
| 84 | dnl given an unknown flag rather than error out. |
| 85 | AC_LANG_PUSH([C++]) |
| 86 | AX_CHECK_COMPILE_FLAG([-Werror=unknown-warning-option],[ |
| 87 | ax_compiler_flags_test="-Werror=unknown-warning-option" |
| 88 | ],[ |
| 89 | ax_compiler_flags_test="" |
| 90 | ]) |
| 91 | AX_APPEND_COMPILE_FLAGS(m4_flatten([ |
| 92 | -Wmissing-braces |
| 93 | -Wnon-virtual-dtor |
| 94 | -Woverloaded-virtual |
| 95 | -Wreorder |
| 96 | -Wsign-compare |
Tobias Sargeant | b37547b | 2017-03-24 12:51:47 +0000 | [diff] [blame] | 97 | -Wunused-local-typedefs |
Mike Frysinger | 6cc0375 | 2017-02-06 15:10:13 -0500 | [diff] [blame] | 98 | -Wunused-variable |
| 99 | -Wvla |
| 100 | ]), [WARN_CXXFLAGS], [${ax_compiler_flags_test}]) |
| 101 | AS_VAR_APPEND([WARN_CXXFLAGS], " -Werror") |
| 102 | AC_LANG_POP([C++]) |
| 103 | AC_SUBST([WARN_CXXFLAGS]) |
| 104 | |
Lars Volker | ffe3e47 | 2017-05-10 22:50:32 +0200 | [diff] [blame] | 105 | dnl Test support for O_CLOEXEC |
| 106 | AX_CHECK_DEFINE([fcntl.h], [O_CLOEXEC], [], |
| 107 | [AC_DEFINE([O_CLOEXEC], [0], [Fallback definition for old systems])]) |
| 108 | |
ted.mielczarek | 53a8b1a | 2010-08-31 15:09:01 +0000 | [diff] [blame] | 109 | # Only build Linux client libs when compiling for Linux |
| 110 | case $host in |
digit@chromium.org | 62d486b | 2012-08-21 14:34:48 +0000 | [diff] [blame] | 111 | *-*-linux* | *-android* ) |
| 112 | LINUX_HOST=true |
| 113 | ;; |
ted.mielczarek | 53a8b1a | 2010-08-31 15:09:01 +0000 | [diff] [blame] | 114 | esac |
| 115 | AM_CONDITIONAL(LINUX_HOST, test x$LINUX_HOST = xtrue) |
| 116 | |
digit@chromium.org | 62d486b | 2012-08-21 14:34:48 +0000 | [diff] [blame] | 117 | # Only use Android support headers when compiling for Android |
| 118 | case $host in |
| 119 | *-android*) |
| 120 | ANDROID_HOST=true |
| 121 | ;; |
| 122 | esac |
| 123 | AM_CONDITIONAL(ANDROID_HOST, test x$ANDROID_HOST = xtrue) |
| 124 | |
Mike Frysinger | 3f736ce | 2016-01-27 16:45:21 -0500 | [diff] [blame] | 125 | # Some tools (like mac ones) only support x86 currently. |
| 126 | case $host_cpu in |
| 127 | i?86|x86_64) |
| 128 | X86_HOST=true |
| 129 | ;; |
| 130 | esac |
| 131 | AM_CONDITIONAL(X86_HOST, test x$X86_HOST = xtrue) |
| 132 | |
ted.mielczarek | e574a2a | 2010-10-05 19:38:22 +0000 | [diff] [blame] | 133 | AC_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]) |
| 149 | AM_CONDITIONAL(DISABLE_PROCESSOR, test x$disable_processor = xtrue) |
| 150 | |
ted.mielczarek | dbf409c | 2011-02-28 14:05:22 +0000 | [diff] [blame] | 151 | AC_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]) |
| 167 | AM_CONDITIONAL(DISABLE_TOOLS, test x$disable_tools = xtrue) |
| 168 | |
| 169 | if 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.mielczarek | e574a2a | 2010-10-05 19:38:22 +0000 | [diff] [blame] | 171 | fi |
| 172 | |
Mike Frysinger | f820ead | 2016-01-25 19:27:56 -0500 | [diff] [blame] | 173 | AC_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]) |
| 189 | AM_CONDITIONAL(SYSTEM_TEST_LIBS, test x$system_test_libs = xtrue) |
| 190 | |
Mike Frysinger | f820ead | 2016-01-25 19:27:56 -0500 | [diff] [blame] | 191 | AC_ARG_VAR([GMOCK_CFLAGS], [Compiler flags for gmock]) |
| 192 | AC_ARG_VAR([GMOCK_LIBS], [Linker flags for gmock]) |
Mike Frysinger | f820ead | 2016-01-25 19:27:56 -0500 | [diff] [blame] | 193 | AC_ARG_VAR([GTEST_CFLAGS], [Compiler flags for gtest]) |
| 194 | AC_ARG_VAR([GTEST_LIBS], [Linker flags for gtest]) |
| 195 | if test x$system_test_libs = xtrue; then |
Allen Webb | 488566d | 2019-06-14 13:06:07 -0700 | [diff] [blame] | 196 | : "${GMOCK_CFLAGS:=-pthread}" |
| 197 | : "${GMOCK_LIBS:=-lgmock -lgtest -pthread -lpthread}" |
| 198 | : "${GTEST_CFLAGS:=-pthread}" |
| 199 | : "${GTEST_LIBS:=-lgtest -pthread -lpthread}" |
Mike Frysinger | f820ead | 2016-01-25 19:27:56 -0500 | [diff] [blame] | 200 | fi |
| 201 | |
mmentovai | 0dbedc9 | 2006-09-25 21:16:15 +0000 | [diff] [blame] | 202 | AC_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]) |
| 219 | AM_CONDITIONAL(SELFTEST, test x$selftest = xtrue) |
| 220 | |
Ted Mielczarek | 2ecb2ba | 2016-10-24 15:16:28 -0400 | [diff] [blame] | 221 | AC_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]) |
| 243 | AC_ARG_VAR([RUST_DEMANGLE_CFLAGS], [Compiler flags for rust-demangle]) |
| 244 | AC_ARG_VAR([RUST_DEMANGLE_LIBS], [Linker flags for rust-demangle]) |
| 245 | |
Lars Volker | 49907e1 | 2018-01-31 13:29:11 -0800 | [diff] [blame] | 246 | AC_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]) |
| 263 | AM_CONDITIONAL(TESTS_AS_ROOT, test x$tests_as_root = xtrue) |
| 264 | |
vapier@chromium.org | 1b309ed | 2014-08-27 02:10:55 +0000 | [diff] [blame] | 265 | AC_CONFIG_FILES(m4_flatten([ |
| 266 | breakpad.pc |
| 267 | breakpad-client.pc |
| 268 | Makefile |
| 269 | ])) |
| 270 | |
bryner | cb91a2f | 2006-08-25 21:14:45 +0000 | [diff] [blame] | 271 | AC_OUTPUT |