2014-06-08 19:36:06 -05:00
|
|
|
m4_define([jq_version], m4_esyscmd_s([git describe --tags --dirty --match 'jq-*'|sed 's/^jq-//']))
|
2013-12-31 17:15:44 -06:00
|
|
|
|
|
|
|
AC_INIT([jq], [jq_version], [mu@netsoc.tcd.ie],
|
2012-11-27 16:02:59 -06:00
|
|
|
[jq], [http://stedolan.github.com/jq/])
|
|
|
|
|
|
|
|
dnl Created autoconf implementation thompson@dtosolutions, 26NOV12
|
|
|
|
AC_PREREQ([2.61])
|
|
|
|
AC_CONFIG_AUX_DIR([config])
|
2013-09-01 18:58:26 +10:00
|
|
|
AM_INIT_AUTOMAKE([parallel-tests foreign -Wall])
|
2013-02-03 00:09:47 -06:00
|
|
|
AM_SILENT_RULES([yes])
|
2014-01-25 18:55:58 +01:00
|
|
|
AM_PROG_AR
|
2012-11-27 16:02:59 -06:00
|
|
|
AC_PROG_CC
|
|
|
|
AC_PROG_CC_STDC
|
|
|
|
AC_PROG_CPP_WERROR
|
2012-11-28 01:08:23 -06:00
|
|
|
AC_PROG_YACC
|
2013-06-16 08:25:12 -05:00
|
|
|
AC_OBJEXT
|
|
|
|
AC_EXEEXT
|
|
|
|
LT_INIT([shared static win32-dll])
|
2012-11-27 16:02:59 -06:00
|
|
|
AM_PROG_CC_C_O
|
|
|
|
|
2012-11-28 01:08:23 -06:00
|
|
|
dnl couldn't use AM_PROG_LEX as it doesn't support header files like the
|
|
|
|
dnl AC_PROG_YACC macros...
|
|
|
|
|
2014-01-01 23:10:00 -06:00
|
|
|
dnl check bison version
|
|
|
|
AC_MSG_CHECKING([bison version])
|
|
|
|
if test "$YACC" != "bison -y"; then
|
|
|
|
AC_MSG_RESULT([not bison])
|
|
|
|
elif $YACC --help | grep -- --warnings >/dev/null; then
|
|
|
|
AC_MSG_RESULT([ok])
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
AC_MSG_ERROR([You need bison version 2.5 or more recent.])
|
|
|
|
fi
|
|
|
|
|
2012-11-28 01:08:23 -06:00
|
|
|
dnl
|
|
|
|
dnl these program checks should probably be deleted
|
|
|
|
dnl
|
|
|
|
|
2013-05-09 11:31:17 +01:00
|
|
|
AC_PROG_LEX
|
|
|
|
if test "x$LEX" != xflex; then
|
|
|
|
LEX="$SHELL $missing_dir/missing flex"
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
2014-06-18 19:49:38 -04:00
|
|
|
##########################################################################
|
|
|
|
# check for ONIGURUMA library
|
|
|
|
##########################################################################
|
|
|
|
|
|
|
|
AC_ARG_WITH([oniguruma],
|
|
|
|
[AS_HELP_STRING([--with-oniguruma=prefix],
|
|
|
|
[try this for a non-standard install prefix of the oniguruma library])],
|
|
|
|
[ONIGURUMAPATHSET=1],
|
|
|
|
[ONIGURUMAPATHSET=0])
|
|
|
|
|
|
|
|
if test $ONIGURUMAPATHSET == 1; then
|
|
|
|
CFLAGS="$CFLAGS -I${with_oniguruma}/include"
|
|
|
|
LDFLAGS="$LDFLAGS -L${with_oniguruma}/lib"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# store current *FLAGS and merge with AM_*FLAGS for compilation and linker check
|
|
|
|
OLD_CFLAGS=$CFLAGS;
|
|
|
|
OLD_LDFLAGS=$LDFLAGS;
|
|
|
|
CFLAGS="$AM_CFLAGS $CFLAGS"
|
|
|
|
LDFLAGS="$AM_LDFLAGS $LDFLAGS"
|
|
|
|
|
|
|
|
# ensure the library to check for is covered by the LIBS variable
|
|
|
|
OLD_LIBS=$LIBS
|
|
|
|
LIBS="$LIBS -lonig"
|
|
|
|
|
|
|
|
# check for ONIGURUMA library headers
|
|
|
|
AC_MSG_CHECKING([for oniguruma.h])
|
|
|
|
# try to compile a file that includes a header of the library oniguruma
|
|
|
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ #include <oniguruma.h> ])],
|
|
|
|
[AC_MSG_RESULT([yes])
|
|
|
|
# try to link the function 'onig_free' out of library oniguruma
|
|
|
|
AC_MSG_CHECKING([for oniguruma usability])
|
|
|
|
AC_LINK_IFELSE(
|
|
|
|
[AC_LANG_PROGRAM([[#include <oniguruma.h>]],
|
|
|
|
[[onig_free(0);]])],
|
|
|
|
[AC_MSG_RESULT([yes])
|
|
|
|
FOUND_ONIGURUMA=1;],
|
|
|
|
[AC_MSG_RESULT([no])
|
|
|
|
LIBS=$OLD_LIBS; dnl reset to old value since oniguruma was not found
|
|
|
|
FOUND_ONIGURUMA=0;])],
|
|
|
|
[AC_MSG_RESULT([not found])
|
|
|
|
FOUND_ONIGURUMA=0;])
|
|
|
|
|
|
|
|
# reset original *FLAGS
|
|
|
|
CFLAGS=$OLD_CFLAGS
|
|
|
|
LDFLAGS=$OLD_LDFLAGS
|
|
|
|
|
|
|
|
# handle check results
|
|
|
|
if test $FOUND_ONIGURUMA != 1; then
|
|
|
|
AC_MSG_NOTICE([Oniguruma was not found.])
|
|
|
|
AC_MSG_NOTICE([ Try setting the location using '--with-oniguruma=PREFIX' ])
|
|
|
|
AC_MSG_ERROR([ oniguruma is required to build jq.])
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-11-27 16:02:59 -06:00
|
|
|
dnl Check for valgrind
|
|
|
|
AC_CHECK_PROGS(valgrind_cmd, valgrind)
|
2013-05-09 15:22:38 +01:00
|
|
|
if test "x$valgrind_cmd" = "x" ; then
|
|
|
|
AC_MSG_WARN([valgrind is required to test jq.])
|
2012-11-27 16:02:59 -06:00
|
|
|
fi
|
2014-07-09 00:55:20 -04:00
|
|
|
AC_CHECK_FUNCS(memmem)
|
2012-11-27 16:02:59 -06:00
|
|
|
|
2013-05-09 15:22:38 +01:00
|
|
|
|
|
|
|
dnl Don't attempt to build docs if there's no Ruby lying around
|
2013-05-09 20:27:12 +01:00
|
|
|
AC_ARG_ENABLE([docs],
|
2013-05-09 15:22:38 +01:00
|
|
|
AC_HELP_STRING([--disable-docs], [don't build docs]))
|
|
|
|
|
|
|
|
AS_IF([test "x$enable_docs" != "xno"],[
|
2013-05-09 20:27:12 +01:00
|
|
|
AC_CHECK_PROGS(bundle_cmd, bundle)
|
2013-06-05 16:40:01 +01:00
|
|
|
|
|
|
|
AC_CACHE_CHECK([for Ruby dependencies], [jq_cv_ruby_deps],
|
|
|
|
[jq_cv_ruby_deps=yes;
|
|
|
|
AS_IF([test "x$bundle_cmd" = "x" || \
|
|
|
|
! bmsg="`cd ${srcdir}/docs; "$bundle_cmd" check 2>/dev/null`"],[
|
|
|
|
AC_MSG_WARN([$bmsg])
|
|
|
|
cat <<EOF
|
2013-05-09 20:27:12 +01:00
|
|
|
*****************************************************************
|
|
|
|
* Ruby dependencies for building jq documentation not found. *
|
|
|
|
* You can still build, install and hack on jq, but the manpage *
|
|
|
|
* will not be rebuilt and some of the tests won't run. *
|
|
|
|
* See docs/README.md for how to install the docs dependencies. *
|
|
|
|
*****************************************************************
|
|
|
|
EOF
|
2013-06-05 16:40:01 +01:00
|
|
|
jq_cv_ruby_deps=no
|
|
|
|
])])
|
|
|
|
|
|
|
|
if test "x$jq_cv_ruby_deps" != "xyes"; then
|
|
|
|
enable_docs=no
|
|
|
|
fi
|
2013-05-09 15:22:38 +01:00
|
|
|
])
|
|
|
|
|
|
|
|
AM_CONDITIONAL([ENABLE_DOCS], [test "x$enable_docs" != xno])
|
2014-04-16 18:42:36 -05:00
|
|
|
|
2014-06-16 21:28:30 -05:00
|
|
|
AC_FIND_FUNC([isatty], [c], [#include <unistd.h>], [0])
|
|
|
|
AC_FIND_FUNC([_isatty], [c], [#include <io.h>], [0])
|
|
|
|
|
2014-04-17 20:17:06 -05:00
|
|
|
AC_ARG_ENABLE([pthread-tls],
|
|
|
|
[AC_HELP_STRING([--enable-pthread-tls],
|
|
|
|
[Enable use of pthread thread local storage])],
|
|
|
|
[],
|
|
|
|
[enable_pthread_tls=no])
|
|
|
|
|
|
|
|
if test $enable_pthread_tls = yes; then
|
|
|
|
AC_FIND_FUNC([pthread_key_create], [pthread], [#include <pthread.h>], [NULL, NULL])
|
|
|
|
AC_FIND_FUNC([pthread_once], [pthread], [#include <pthread.h>], [NULL, NULL])
|
|
|
|
AC_FIND_FUNC([atexit], [pthread], [#include <stdlib.h>], [NULL])
|
|
|
|
fi
|
2014-04-16 18:42:36 -05:00
|
|
|
|
|
|
|
dnl Thread local storage
|
|
|
|
have___thread=no
|
|
|
|
AC_MSG_CHECKING(for thread-local storage)
|
|
|
|
AC_LINK_IFELSE([AC_LANG_SOURCE([
|
|
|
|
static __thread int x ;
|
|
|
|
int main () { x = 123; return x; }
|
|
|
|
])], have___thread=yes)
|
|
|
|
if test $have___thread = yes; then
|
|
|
|
AC_DEFINE([HAVE___THREAD],1,[Define to 1 if the system supports __thread])
|
|
|
|
fi
|
|
|
|
AC_MSG_RESULT($have___thread)
|
|
|
|
|
2014-06-11 10:37:32 +02:00
|
|
|
AC_C_BIGENDIAN(
|
|
|
|
AC_DEFINE([IEEE_MC68k], 1, [machine is bigendian]),
|
|
|
|
AC_DEFINE([IEEE_8087], 1, [machine is littleendian]),
|
|
|
|
AC_MSG_ERROR(unknown endianess),
|
|
|
|
AC_MSG_ERROR(universial endianess not supported)
|
|
|
|
)
|
2014-04-16 18:42:36 -05:00
|
|
|
|
2013-05-09 20:27:12 +01:00
|
|
|
AC_SUBST([BUNDLER], ["$bundle_cmd"])
|
2013-05-09 15:22:38 +01:00
|
|
|
|
2013-06-23 11:47:42 +01:00
|
|
|
AC_CONFIG_MACRO_DIR([config/m4])
|
2012-11-27 16:02:59 -06:00
|
|
|
AC_CONFIG_FILES([Makefile])
|
|
|
|
AC_OUTPUT
|
2013-05-08 02:30:08 +01:00
|
|
|
|
|
|
|
|