configure.ac
This file
Path
configure.ac
305 lines · 10.3 KiB
Last changed by
Randomize hash seed to mitigate hash collision DoS attacksitchynybefore adoption0c7d133
History of this fileTake it
The walk stopped after 200 commits: lines older than fa6a2ff point at it.
website: remove unused root path on building website (#3248)itchynybefore adoptionfa6a2ff
lines 1–8why, one step back1m4_define([jq_version], m4_esyscmd_s([scripts/version])))23AC_INIT([jq],[jq_version],[https://github.com/jqlang/jq/issues],[jq],[https://jqlang.org])45dnl Created autoconf implementation thompson@dtosolutions, 26NOV126AC_PREREQ([2.65])7AC_CONFIG_AUX_DIR([config])8AC_USE_SYSTEM_EXTENSIONSAdd Solaris support (#3515)Vladimír Marekbefore adoption9f778b4
lines 9–14why, one step back910dnl Prefer GNU make on Solaris where /usr/bin/make is not suitable11AS_IF([test -z "$MAKE"], [12 AS_CASE(["`uname -s`"], [SunOS], [MAKE=/usr/gnu/bin/make])13])14website: remove unused root path on building website (#3248)itchynybefore adoptionfa6a2ff
lines 15–57why, one step back15AM_INIT_AUTOMAKE([1.11.2 subdir-objects parallel-tests foreign -Wall])16AM_SILENT_RULES([yes])17AM_PROG_AR18AM_MAINTAINER_MODE([disable])19AC_PROG_CC20m4_version_prereq([2.70], [], [AC_PROG_CC_STDC])21AC_PROG_CPP_WERROR22AC_PROG_YACC23AC_OBJEXT24AC_EXEEXT25LT_INIT([shared static win32-dll])26AM_PROG_CC_C_O2728AC_SYS_LARGEFILE # issue 21672930dnl couldn't use AM_PROG_LEX as it doesn't support header files like the31dnl AC_PROG_YACC macros...3233dnl check bison version3435if test "$USE_MAINTAINER_MODE" = yes; then36 if test "$YACC" != "bison -y"; then37 AC_MSG_CHECKING([bison version])38 AC_MSG_RESULT([not bison])39 else40 AX_PROG_BISON_VERSION([3],41 [],42 [AC_MSG_ERROR([You need bison version 3.0 or greater])])43 fi4445 AC_CHECK_PROGS(LEX, flex lex)46fi4748AC_CHECK_FUNCS(memmem)4950AC_CHECK_HEADER("sys/cygwin.h", [have_cygwin=1;])51AC_CHECK_HEADER("shlwapi.h",[have_shlwapi=1;])52AM_CONDITIONAL([WIN32], [test "x$have_shlwapi" = x1 && test ! "x$have_cygwin" = x1])5354dnl Running tests with Valgrind is slow. It is faster to iterate on55dnl code without Valgrind until tests pass, then enable Valgrind and56dnl fix leaks.57AC_ARG_ENABLE([valgrind],Disable Valgrind by default during testing (#3269)itchynybefore adoption5df471f
line 58why, one step back58 AS_HELP_STRING([--enable-valgrind],[enable Valgrind during testing]))website: remove unused root path on building website (#3248)itchynybefore adoptionfa6a2ff
line 59why, one step back59Disable Valgrind by default during testing (#3269)itchynybefore adoption5df471f
line 60why, one step back60dnl Address sanitizer (ASan)website: remove unused root path on building website (#3248)itchynybefore adoptionfa6a2ff
lines 61–116why, one step back61AC_ARG_ENABLE([asan],62 AS_HELP_STRING([--enable-asan],[enable address sanitizer]))6364dnl Undefined Behavior Sanitizer65AC_ARG_ENABLE([ubsan],66 AS_HELP_STRING([--enable-ubsan],[enable undefined behavior sanitizer]))6768dnl Code coverage69AC_ARG_ENABLE([gcov],70 AS_HELP_STRING([--enable-gcov],[enable gcov code coverage tool]))7172dnl Don't attempt to build docs if python deps aren't installed73AC_ARG_ENABLE([docs],74 AS_HELP_STRING([--disable-docs],[do not build docs]), [], [enable_docs=yes])7576dnl Don't attempt to build the error injection object (if there is no LD_PRELOAD support)77AC_ARG_ENABLE([error-injection],78 AS_HELP_STRING([--enable-error-injection],[build and test with error injection]))7980dnl Enable building all static81AC_ARG_ENABLE([all-static],82 AS_HELP_STRING([--enable-all-static],[link jq with static libraries only]))8384dnl find pipenv85AC_ARG_VAR([PIPENV], [pipenv command])86AC_CHECK_PROGS([PIPENV], pipenv)8788AS_IF([test "x$enable_docs" != "xno"],[89 AC_CACHE_CHECK([for Python dependencies], [jq_cv_python_deps],[90 jq_cv_python_deps=yes91 AS_IF([test "x$PIPENV" = "x" || \92 ! bmsg="`cd ${srcdir}/docs; LC_ALL=$LANG "$PIPENV" --venv`"],[93 jq_cv_python_deps=no94 ])95 ])9697 AS_IF([test "x$jq_cv_python_deps" != "xyes"], [98 AC_MSG_WARN([Error checking python dependencies: $bmsg99*****************************************************************100* Python dependencies for building jq documentation not found. *101* You can still build, install and hack on jq, but the manpage *102* will not be rebuilt and new manpage tests will not be run. *103* See docs/README.md for how to install the docs dependencies. *104*****************************************************************])105 enable_docs=no106 ])107])108109dnl Disable decNumber support110AC_ARG_ENABLE([decnum],111 AS_HELP_STRING([--disable-decnum],[disable decnum support]))112113AS_IF([test "x$enable_decnum" != "xno"],[114 AC_DEFINE([USE_DECNUM], 1, [Define to enable decnum support.])115])116Disable Valgrind by default during testing (#3269)itchynybefore adoption5df471f
line 117why, one step back117AM_CONDITIONAL([ENABLE_VALGRIND], [test "x$enable_valgrind" = xyes])website: remove unused root path on building website (#3248)itchynybefore adoptionfa6a2ff
lines 118–151why, one step back118AM_CONDITIONAL([ENABLE_ASAN], [test "x$enable_asan" = xyes])119AM_CONDITIONAL([ENABLE_UBSAN], [test "x$enable_ubsan" = xyes])120AM_CONDITIONAL([ENABLE_GCOV], [test "x$enable_gcov" = xyes])121AM_CONDITIONAL([ENABLE_DOCS], [test "x$enable_docs" != xno])122AM_CONDITIONAL([ENABLE_ERROR_INJECTION], [test "x$enable_error_injection" = xyes])123AM_CONDITIONAL([ENABLE_ALL_STATIC], [test "x$enable_all_static" = xyes])124125dnl Find pthread, if we have it. We do this first because we may set -pthread on CFLAGS126dnl which can cause various macros to be defined (__REENTRANT on Darwin, for example)127AX_PTHREAD([128 AC_DEFINE([HAVE_PTHREAD], [1], [Define to enable POSIX threads support.])129 LIBS="$PTHREAD_LIBS $LIBS"130 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"131 CC="$PTHREAD_CC"132])133134AC_FUNC_ALLOCA135136AC_FIND_FUNC([isatty], [c], [#include <unistd.h>], [0])137AC_FIND_FUNC([_isatty], [c], [#include <io.h>], [0])138AC_FIND_FUNC([strptime], [c], [#include <time.h>], [0, 0, 0])139AC_FIND_FUNC([strftime], [c], [#include <time.h>], [0, 0, 0, 0])140AC_FIND_FUNC([setenv], [c], [#include <stdlib.h>], [0, 0, 0])141AC_FIND_FUNC([timegm], [c], [#include <time.h>], [0])142AC_FIND_FUNC([gmtime_r], [c], [#include <time.h>], [0, 0])143AC_FIND_FUNC([gmtime], [c], [#include <time.h>], [0])144AC_FIND_FUNC([localtime_r], [c], [#include <time.h>], [0, 0])145AC_FIND_FUNC([localtime], [c], [#include <time.h>], [0])146AC_FIND_FUNC([gettimeofday], [c], [#include <sys/time.h>], [0, 0])147AC_CHECK_MEMBER([struct tm.tm_gmtoff], [AC_DEFINE([HAVE_TM_TM_GMT_OFF],1,[Define to 1 if the system has the tm_gmt_off field in struct tm])],148 [], [[#include <time.h>]])149AC_CHECK_MEMBER([struct tm.__tm_gmtoff], [AC_DEFINE([HAVE_TM___TM_GMT_OFF],1,[Define to 1 if the system has the __tm_gmt_off field in struct tm])],150 [], [[#include <time.h>]])151AC_FIND_FUNC([setlocale], [c], [#include <locale.h>], [0,0])Randomize hash seed to mitigate hash collision DoS attacksitchynybefore adoption0c7d133
lines 152–153why, one step back152AC_FIND_FUNC([arc4random], [c], [#include <stdlib.h>], [])153AC_FIND_FUNC([getentropy], [c], [#include <unistd.h>], [0, 0])website: remove unused root path on building website (#3248)itchynybefore adoptionfa6a2ff
lines 154–292why, one step back154155dnl Figure out if we have the pthread functions we actually need156AC_FIND_FUNC_NO_LIBS([pthread_key_create], [], [#include <pthread.h>], [NULL, NULL])157AC_FIND_FUNC_NO_LIBS([pthread_once], [], [#include <pthread.h>], [NULL, NULL])158AC_FIND_FUNC_NO_LIBS([atexit], [], [#include <stdlib.h>], [NULL])159160dnl libm math.h functions161AC_CHECK_MATH_FUNC(acos)162AC_CHECK_MATH_FUNC(acosh)163AC_CHECK_MATH_FUNC(asin)164AC_CHECK_MATH_FUNC(asinh)165AC_CHECK_MATH_FUNC(atan2)166AC_CHECK_MATH_FUNC(atan)167AC_CHECK_MATH_FUNC(atanh)168AC_CHECK_MATH_FUNC(cbrt)169AC_CHECK_MATH_FUNC(ceil)170AC_CHECK_MATH_FUNC(copysign)171AC_CHECK_MATH_FUNC(cos)172AC_CHECK_MATH_FUNC(cosh)173AC_CHECK_MATH_FUNC(drem)174AC_CHECK_MATH_FUNC(erf)175AC_CHECK_MATH_FUNC(erfc)176AC_CHECK_MATH_FUNC(exp10)177AC_CHECK_MATH_FUNC(__exp10) dnl macOS has an __exp10178AC_CHECK_MATH_FUNC(exp2)179AC_CHECK_MATH_FUNC(exp)180AC_CHECK_MATH_FUNC(expm1)181AC_CHECK_MATH_FUNC(fabs)182AC_CHECK_MATH_FUNC(fdim)183AC_CHECK_MATH_FUNC(floor)184AC_CHECK_MATH_FUNC(fma)185AC_CHECK_MATH_FUNC(fmax)186AC_CHECK_MATH_FUNC(fmin)187AC_CHECK_MATH_FUNC(fmod)188AC_CHECK_MATH_FUNC(frexp)189AC_CHECK_MATH_FUNC(gamma)190AC_CHECK_MATH_FUNC(hypot)191AC_CHECK_MATH_FUNC(j0)192AC_CHECK_MATH_FUNC(j1)193AC_CHECK_MATH_FUNC(jn)194AC_CHECK_MATH_FUNC(ldexp)195AC_CHECK_MATH_FUNC(lgamma)196AC_CHECK_MATH_FUNC(log10)197AC_CHECK_MATH_FUNC(log1p)198AC_CHECK_MATH_FUNC(log2)199AC_CHECK_MATH_FUNC(log)200AC_CHECK_MATH_FUNC(logb)201AC_CHECK_MATH_FUNC(modf)202AC_CHECK_MATH_FUNC(lgamma_r)203AC_CHECK_MATH_FUNC(nearbyint)204AC_CHECK_MATH_FUNC(nextafter)205AC_CHECK_MATH_FUNC(nexttoward)206AC_CHECK_MATH_FUNC(pow)207AC_CHECK_MATH_FUNC(remainder)208AC_CHECK_MATH_FUNC(rint)209AC_CHECK_MATH_FUNC(round)210AC_CHECK_MATH_FUNC(scalb)211AC_CHECK_MATH_FUNC(scalbln)212AC_CHECK_MATH_FUNC(significand)213dnl scalbn and ilogb are used on macos to replace significand if we don't have frexp214AC_CHECK_MATH_FUNC(scalbn)215AC_CHECK_MATH_FUNC(ilogb)216217AC_CHECK_MATH_FUNC(sin)218AC_CHECK_MATH_FUNC(sinh)219AC_CHECK_MATH_FUNC(sqrt)220AC_CHECK_MATH_FUNC(tan)221AC_CHECK_MATH_FUNC(tanh)222AC_CHECK_MATH_FUNC(tgamma)223AC_CHECK_MATH_FUNC(trunc)224AC_CHECK_MATH_FUNC(y0)225AC_CHECK_MATH_FUNC(y1)226AC_CHECK_MATH_FUNC(yn)227228dnl Thread local storage229have___thread=no230AC_MSG_CHECKING(for thread-local storage)231AC_LINK_IFELSE([AC_LANG_SOURCE([232static __thread int x ;233int main () { x = 123; return x; }234])], have___thread=yes)235if test $have___thread = yes; then236 AC_DEFINE([HAVE___THREAD],1,[Define to 1 if the system supports __thread])237fi238AC_MSG_RESULT($have___thread)239240AC_C_BIGENDIAN(241 AC_DEFINE([IEEE_MC68k], 1, [machine is bigendian]),242 AC_DEFINE([IEEE_8087], 1, [machine is littleendian]),243 AC_MSG_ERROR(unknown endianness),244 AC_MSG_ERROR(universal endianness not supported)245)246247dnl Oniguruma248AC_ARG_WITH([oniguruma],249 [AS_HELP_STRING([--with-oniguruma=prefix],250 [try this for a non-standard install prefix of the oniguruma library])], ,251 [with_oniguruma=yes])252253onig_CFLAGS=254onig_LDFLAGS=255build_oniguruma=no256AS_IF([test "x$with_oniguruma" != xno], [257 save_CFLAGS="$CFLAGS"258 save_LDFLAGS="$LDFLAGS"259 AS_IF([test "x$with_oniguruma" != xyes], [260 AS_IF([test "x$with_oniguruma" = xbuiltin], [261 build_oniguruma=yes262 ], [263 onig_CFLAGS="-I${with_oniguruma}/include"264 onig_LDFLAGS="-L${with_oniguruma}/lib"265 ])266 ])267 AS_IF([test "x$build_oniguruma" = xno], [268 # check for ONIGURUMA library, either in /usr or where requested269 CFLAGS="$CFLAGS $onig_CFLAGS"270 LDFLAGS="$LDFLAGS $onig_LDFLAGS"271 AC_CHECK_HEADER("oniguruma.h",272 AC_CHECK_LIB([onig],[onig_version]))273 # handle check results274 AS_IF([test "x$ac_cv_lib_onig_onig_version" != "xyes"], [275 build_oniguruma=yes276 AC_MSG_NOTICE([Oniguruma was not found. Will use the packaged oniguruma.])277 ])278 ])279 AS_IF([test "x$build_oniguruma" = xyes && test -f "${srcdir}/vendor/oniguruma/configure.ac" ], [280 onig_CFLAGS="-I${srcdir}/vendor/oniguruma/src"281 onig_LDFLAGS="-L${srcdir}/vendor/oniguruma/src -Wl,-rpath,${libdir}"282 AC_CONFIG_SUBDIRS([vendor/oniguruma])283 AC_DEFINE([HAVE_LIBONIG],1,[Define to 1 if the system includes libonig])284 ])285 CFLAGS="$save_CFLAGS"286 LDFLAGS="$save_LDFLAGS"287])288AC_SUBST(onig_CFLAGS)289AC_SUBST(onig_LDFLAGS)290291AM_CONDITIONAL([BUILD_ONIGURUMA], [test "x$build_oniguruma" = xyes])292AM_CONDITIONAL([WITH_ONIGURUMA], [test "x$with_oniguruma" != xno])Add Solaris support (#3515)Vladimír Marekbefore adoption9f778b4
lines 293–300why, one step back293294dnl On Solaris, strptime clears the tm structure before parsing. This breaks the295dnl sentinel logic in builtin.c, which then incorrectly assumes that strptime set296dnl tm_wday and tm_yday. Defining _STRPTIME_DONTZERO disables that behavior.297AS_IF([test "x`uname -s 2>/dev/null`" = "xSunOS"], [298 CPPFLAGS="$CPPFLAGS -D_STRPTIME_DONTZERO"299])300website: remove unused root path on building website (#3248)itchynybefore adoptionfa6a2ff
lines 301–305why, one step back301302AC_CONFIG_MACRO_DIRS([config/m4 m4])303AC_CONFIG_FILES([Makefile libjq.pc])304AC_OUTPUT305