| 1 |
# -*- Autoconf -*- |
| 2 |
# Process this file with autoconf to produce a configure script. |
| 3 |
|
| 4 |
AC_PREREQ([2.61]) |
| 5 |
|
| 6 |
AC_INIT([libsass], m4_esyscmd_s([./version.sh]), [[email protected]]) |
| 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 |
|
| 13 |
# These are flags passed to automake |
| 14 |
# Though they look like gcc flags! |
| 15 |
AM_INIT_AUTOMAKE([foreign parallel-tests -Wall]) |
| 16 |
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([no])]) |
| 17 |
|
| 18 |
# Checks for programs. |
| 19 |
AC_PROG_CC |
| 20 |
AC_PROG_CXX |
| 21 |
AC_LANG_PUSH([C]) |
| 22 |
AC_LANG_PUSH([C++]) |
| 23 |
AC_GNU_SOURCE |
| 24 |
# Check fails on Travis, but it works fine |
| 25 |
# AX_CXX_COMPILE_STDCXX_11([ext],[optional]) |
| 26 |
AC_CHECK_TOOL([AR], [ar], [false]) |
| 27 |
AC_CHECK_TOOL([DLLTOOL], [dlltool], [false]) |
| 28 |
AC_CHECK_TOOL([DLLWRAP], [dllwrap], [false]) |
| 29 |
AC_CHECK_TOOL([WINDRES], [windres], [false]) |
| 30 |
m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) |
| 31 |
LT_INIT([dlopen]) |
| 32 |
|
| 33 |
# Checks for header files. |
| 34 |
AC_CHECK_HEADERS([unistd.h]) |
| 35 |
|
| 36 |
# Checks for typedefs, structures, and compiler characteristics. |
| 37 |
AC_TYPE_SIZE_T |
| 38 |
|
| 39 |
# Checks for library functions. |
| 40 |
AC_FUNC_MALLOC |
| 41 |
AC_CHECK_FUNCS([floor getcwd strtol]) |
| 42 |
|
| 43 |
# Checks for testing. |
| 44 |
AC_ARG_ENABLE(tests, AS_HELP_STRING([--enable-tests], [enable testing the build]), |
| 45 |
[enable_tests="$enableval"], [enable_tests=no]) |
| 46 |
|
| 47 |
AS_CASE([$host], [*-*-mingw*], [is_mingw32=yes], [is_mingw32=no]) |
| 48 |
AM_CONDITIONAL(COMPILER_IS_MINGW32, test "x$is_mingw32" = "xyes") |
| 49 |
|
| 50 |
dnl The dlopen() function is in the C library for *BSD and in |
| 51 |
dnl libdl on GLIBC-based systems |
| 52 |
if test "x$is_mingw32" != "xyes"; then |
| 53 |
AC_SEARCH_LIBS([dlopen], [dl dld], [], [ |
| 54 |
AC_MSG_ERROR([unable to find the dlopen() function]) |
| 55 |
]) |
| 56 |
fi |
| 57 |
|
| 58 |
if test "x$enable_tests" = "xyes"; then |
| 59 |
AC_PROG_CC |
| 60 |
AC_PROG_AWK |
| 61 |
# test need minitest gem |
| 62 |
AC_PATH_PROG(RUBY, [ruby]) |
| 63 |
AC_PATH_PROG(TAPOUT, [tapout]) |
| 64 |
AC_REQUIRE_AUX_FILE([tap-driver]) |
| 65 |
AC_REQUIRE_AUX_FILE([tap-runner]) |
| 66 |
AC_ARG_WITH(sassc-dir, |
| 67 |
AS_HELP_STRING([--with-sassc-dir=<dir>], [specify directory of sassc sources for testing (default: sassc)]), |
| 68 |
[sassc_dir="$withval"], [sassc_dir="sassc"]) |
| 69 |
AC_CHECK_FILE([$sassc_dir/sassc.c], [], [ |
| 70 |
AC_MSG_ERROR([Unable to find sassc directory. |
| 71 |
You must clone the sassc repository in this directory or specify |
| 72 |
the --with-sassc-dir=<dir> argument. |
| 73 |
]) |
| 74 |
]) |
| 75 |
SASS_SASSC_PATH=$sassc_dir |
| 76 |
AC_SUBST(SASS_SASSC_PATH) |
| 77 |
|
| 78 |
AC_ARG_WITH(sass-spec-dir, |
| 79 |
AS_HELP_STRING([--with-sass-spec-dir=<dir>], [specify directory of sass-spec for testing (default: sass-spec)]), |
| 80 |
[sass_spec_dir="$withval"], [sass_spec_dir="sass-spec"]) |
| 81 |
AC_CHECK_FILE([$sass_spec_dir/sass-spec.rb], [], [ |
| 82 |
AC_MSG_ERROR([Unable to find sass-spec directory. |
| 83 |
You must clone the sass-spec repository in this directory or specify |
| 84 |
the --with-sass-spec-dir=<dir> argument. |
| 85 |
]) |
| 86 |
]) |
| 87 |
# Automake doesn't like its tests in an absolute path, so we make it relative. |
| 88 |
case $sass_spec_dir in |
| 89 |
/*) |
| 90 |
SASS_SPEC_PATH=`$RUBY -e "require 'pathname'; puts Pathname.new('$sass_spec_dir').relative_path_from(Pathname.new('$PWD')).to_s"` |
| 91 |
;; |
| 92 |
*) |
| 93 |
SASS_SPEC_PATH="$sass_spec_dir" |
| 94 |
;; |
| 95 |
esac |
| 96 |
AC_SUBST(SASS_SPEC_PATH) |
| 97 |
else |
| 98 |
# we do not really need these paths for non test build |
| 99 |
# but automake may error if we do not define them here |
| 100 |
SASS_SPEC_PATH=sass-spec |
| 101 |
SASS_SASSC_PATH=sassc |
| 102 |
AC_SUBST(SASS_SPEC_PATH) |
| 103 |
AC_SUBST(SASS_SASSC_PATH) |
| 104 |
fi |
| 105 |
|
| 106 |
AM_CONDITIONAL(ENABLE_TESTS, test "x$enable_tests" = "xyes") |
| 107 |
|
| 108 |
AC_ARG_ENABLE([coverage], |
| 109 |
[AS_HELP_STRING([--enable-coverage], |
| 110 |
[enable coverage report for test suite])], |
| 111 |
[enable_cov=$enableval], |
| 112 |
[enable_cov=no]) |
| 113 |
|
| 114 |
if test "x$enable_cov" = "xyes"; then |
| 115 |
|
| 116 |
AC_CHECK_PROG(GCOV, gcov, gcov) |
| 117 |
|
| 118 |
# Remove all optimization flags from C[XX]FLAGS |
| 119 |
changequote({,}) |
| 120 |
CFLAGS=`echo "$CFLAGS -O1 -fno-omit-frame-pointer" | $SED -e 's/-O[0-9]*//g'` |
| 121 |
CXXFLAGS=`echo "$CXXFLAGS -O1 -fno-omit-frame-pointer" | $SED -e 's/-O[0-9]*//g'` |
| 122 |
changequote([,]) |
| 123 |
|
| 124 |
AC_SUBST(GCOV) |
| 125 |
fi |
| 126 |
|
| 127 |
AM_CONDITIONAL(ENABLE_COVERAGE, test "x$enable_cov" = "xyes") |
| 128 |
|
| 129 |
AC_SUBST(PACKAGE_VERSION) |
| 130 |
|
| 131 |
AC_MSG_NOTICE([Building libsass ($VERSION)]) |
| 132 |
|
| 133 |
AC_CONFIG_FILES([GNUmakefile src/GNUmakefile src/support/libsass.pc]) |
| 134 |
AC_OUTPUT |