2 # Process this file with autoconf to produce a configure script.
6 AC_INIT([libsass], m4_esyscmd_s([./version.sh]), [support@moovweb.com])
7 AC_CONFIG_SRCDIR([src/ast.hpp])
8 AC_CONFIG_MACRO_DIR([m4])
9 AC_CONFIG_HEADERS([src/config.h])
10 AC_CONFIG_FILES([include/sass/version.h])
11 AC_CONFIG_AUX_DIR([script])
12 # These are flags passed to automake
13 # Though they look like gcc flags!
14 AM_INIT_AUTOMAKE([foreign parallel-tests -Wall])
15 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([no])])
17 # Checks for programs.
23 # Check fails on Travis, but it works fine
24 # AX_CXX_COMPILE_STDCXX_11([ext],[optional])
25 AC_CHECK_TOOL([AR], [ar], [false])
26 AC_CHECK_TOOL([DLLTOOL], [dlltool], [false])
27 AC_CHECK_TOOL([DLLWRAP], [dllwrap], [false])
28 AC_CHECK_TOOL([WINDRES], [windres], [false])
29 m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
32 # Checks for header files.
33 AC_CHECK_HEADERS([unistd.h])
35 # Checks for typedefs, structures, and compiler characteristics.
38 # Checks for library functions.
40 AC_CHECK_FUNCS([floor getcwd strtol])
43 AC_ARG_ENABLE(tests, AS_HELP_STRING([--enable-tests], [enable testing the build]),
44 [enable_tests="$enableval"], [enable_tests=no])
46 AS_CASE([$host], [*-*-mingw*], [is_mingw32=yes], [is_mingw32=no])
47 AM_CONDITIONAL(COMPILER_IS_MINGW32, test "x$is_mingw32" = "xyes")
49 dnl The dlopen() function is in the C library for *BSD and in
50 dnl libdl on GLIBC-based systems
51 if test "x$is_mingw32" != "xyes"; then
52 AC_SEARCH_LIBS([dlopen], [dl dld], [], [
53 AC_MSG_ERROR([unable to find the dlopen() function])
57 if test "x$enable_tests" = "xyes"; then
60 # test need minitest gem
61 AC_PATH_PROG(RUBY, [ruby])
62 AC_PATH_PROG(TAPOUT, [tapout])
63 AC_REQUIRE_AUX_FILE([tap-driver])
64 AC_REQUIRE_AUX_FILE([tap-runner])
65 AC_ARG_WITH(sassc-dir,
66 AS_HELP_STRING([--with-sassc-dir=<dir>], [specify directory of sassc sources for testing (default: sassc)]),
67 [sassc_dir="$withval"], [sassc_dir="sassc"])
68 AC_CHECK_FILE([$sassc_dir/sassc.c], [], [
69 AC_MSG_ERROR([Unable to find sassc directory.
70 You must clone the sassc repository in this directory or specify
71 the --with-sassc-dir=<dir> argument.
74 SASS_SASSC_PATH=$sassc_dir
75 AC_SUBST(SASS_SASSC_PATH)
77 AC_ARG_WITH(sass-spec-dir,
78 AS_HELP_STRING([--with-sass-spec-dir=<dir>], [specify directory of sass-spec for testing (default: sass-spec)]),
79 [sass_spec_dir="$withval"], [sass_spec_dir="sass-spec"])
80 AC_CHECK_FILE([$sass_spec_dir/sass-spec.rb], [], [
81 AC_MSG_ERROR([Unable to find sass-spec directory.
82 You must clone the sass-spec repository in this directory or specify
83 the --with-sass-spec-dir=<dir> argument.
86 # Automake doesn't like its tests in an absolute path, so we make it relative.
87 case $sass_spec_dir in
89 SASS_SPEC_PATH=`$RUBY -e "require 'pathname'; puts Pathname.new('$sass_spec_dir').relative_path_from(Pathname.new('$PWD')).to_s"`
92 SASS_SPEC_PATH="$sass_spec_dir"
95 AC_SUBST(SASS_SPEC_PATH)
97 # TODO: Remove this when automake requirements are 1.12+
98 AC_MSG_CHECKING([whether we can use TAP mode])
99 tmp=`$AWK '/TEST_LOG_DRIVER/' $srcdir/GNUmakefile.in`
100 if test "x$tmp" != "x"; then
105 AC_MSG_RESULT([$use_tap])
109 AM_CONDITIONAL(ENABLE_TESTS, test "x$enable_tests" = "xyes")
110 AM_CONDITIONAL(USE_TAP, test "x$use_tap" = "xyes")
112 AC_ARG_ENABLE([coverage],
113 [AS_HELP_STRING([--enable-coverage],
114 [enable coverage report for test suite])],
115 [enable_cov=$enableval],
118 if test "x$enable_cov" = "xyes"; then
120 AC_CHECK_PROG(GCOV, gcov, gcov)
122 # Remove all optimization flags from C[XX]FLAGS
124 CFLAGS=`echo "$CFLAGS -O1 -fno-omit-frame-pointer" | $SED -e 's/-O[0-9]*//g'`
125 CXXFLAGS=`echo "$CXXFLAGS -O1 -fno-omit-frame-pointer" | $SED -e 's/-O[0-9]*//g'`
131 AM_CONDITIONAL(ENABLE_COVERAGE, test "x$enable_cov" = "xyes")
133 AC_SUBST(PACKAGE_VERSION)
135 AC_MSG_NOTICE([Building libsass ($VERSION)])
137 AC_CONFIG_FILES([GNUmakefile src/GNUmakefile src/support/libsass.pc])