Skip to content

Commit

Permalink
Merge pull request sass#992 from mgreter/dlopen
Browse files Browse the repository at this point in the history
Simplify autotools build
  • Loading branch information
mgreter committed Mar 27, 2015
2 parents cfce077 + 3ffa142 commit b287d31
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 36 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Makefile.in
/m4/ltsugar.m4
/m4/ltversion.m4
/m4/lt~obsolete.m4
/script/ar-lib
/script/compile
/script/config.guess
/script/config.sub
Expand Down
39 changes: 12 additions & 27 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -1,29 +1,21 @@
ACLOCAL_AMFLAGS = -I m4

AM_LDFLAGS = -lstdc++ -lm
AM_CFLAGS = -Wall
AM_CXXFLAGS = -Wall
AM_COPT = -Wall -O2
AM_COVLDFLAGS =

if COMPILER_IS_MINGW32
AM_CXXFLAGS += -std=gnu++0x
else
AM_CFLAGS += -fPIC
AM_CXXFLAGS += -fPIC
AM_CXXFLAGS += -std=c++0x
AM_LDFLAGS += -ldl
if ENABLE_COVERAGE
AM_COPT = -O0 --coverage
AM_COVLDFLAGS += -lgcov
endif

AM_CFLAGS += -DLIBSASS_VERSION="\"$(VERSION)\""
AM_CXXFLAGS += -DLIBSASS_VERSION="\"$(VERSION)\""
AM_CFLAGS = $(AM_COPT)
AM_CXXFLAGS = $(AM_COPT)
AM_LDFLAGS = $(AM_COPT) $(AM_COVLDFLAGS)

if ENABLE_COVERAGE
AM_CFLAGS += -O0 --coverage
AM_CXXFLAGS += -O0 --coverage
AM_LDFLAGS += -O0 --coverage -lgcov
if COMPILER_IS_MINGW32
AM_CXXFLAGS += -std=gnu++0x
else
AM_CFLAGS += -O2
AM_CXXFLAGS += -O2
AM_LDFLAGS += -O2
AM_CXXFLAGS += -std=c++0x
endif

EXTRA_DIST = \
Expand Down Expand Up @@ -88,8 +80,6 @@ libsass_la_SOURCES = \
utf8_string.cpp utf8_string.hpp \
util.cpp util.hpp

libsass_la_CFLAGS = $(AM_CFLAGS)
libsass_la_CXXFLAGS = $(AM_CXXFLAGS)
libsass_la_LDFLAGS = $(AM_LDFLAGS) -no-undefined -version-info 0:9:0

include_HEADERS = sass2scss.h sass_context.h sass_functions.h sass_values.h sass.h
Expand Down Expand Up @@ -139,12 +129,7 @@ else
endif

SASS_TESTER = $(RUBY) $(SASS_SPEC_PATH)/sass-spec.rb

if COMPILER_IS_MINGW32
SASS_TESTER += -c $(SASS_LIBSASS_PATH)/tester.exe
else
SASS_TESTER += -c $(SASS_LIBSASS_PATH)/tester
endif
SASS_TESTER += -c $(SASS_LIBSASS_PATH)/tester$(EXEEXT)

test:
$(SASS_TESTER) --ignore-todo $(LOG_FLAGS) $(SASS_SPEC_PATH) $(SASS_TEST_FLAGS)
Expand Down
22 changes: 17 additions & 5 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@ AC_INIT([libsass], m4_esyscmd_s([./version.sh]), [support@moovweb.com])
AC_CONFIG_SRCDIR([ast.hpp])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([sass_version.h])
AC_CONFIG_AUX_DIR([script])
AM_INIT_AUTOMAKE([foreign parallel-tests])
# These are flags passed to automake
# Though they look like gcc flags!
AM_INIT_AUTOMAKE([foreign parallel-tests -Wall])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([no])])
LT_INIT

# Checks for programs.
AC_PROG_CXX

AC_LANG([C++])
LT_INIT([dlopen])

# Checks for header files.
AC_CHECK_HEADERS([unistd.h])
Expand All @@ -31,6 +33,17 @@ AC_CHECK_FUNCS([floor getcwd strtol])
AC_ARG_ENABLE(tests, AS_HELP_STRING([--enable-tests], [enable testing the build]),
[enable_tests="$enableval"], [enable_tests=no])

AS_CASE([$host], [*-*-mingw32], [is_mingw32=yes], [is_mingw32=no])
AM_CONDITIONAL(COMPILER_IS_MINGW32, test "x$is_mingw32" = "xyes")

dnl The dlopen() function is in the C library for *BSD and in
dnl libdl on GLIBC-based systems
if test "x$is_mingw32" != "xyes"; then
AC_SEARCH_LIBS([dlopen], [dl dld], [], [
AC_MSG_ERROR([unable to find the dlopen() function])
])
fi

if test "x$enable_tests" = "xyes"; then
AC_PROG_CC
AC_PROG_AWK
Expand Down Expand Up @@ -107,8 +120,7 @@ fi

AM_CONDITIONAL(ENABLE_COVERAGE, test "x$enable_cov" = "xyes")

AS_CASE([$host], [*-*-mingw32], [is_mingw32=yes], [is_mingw32=no])
AM_CONDITIONAL(COMPILER_IS_MINGW32, test "x$is_mingw32" = "xyes")
AC_SUBST(PACKAGE_VERSION)

AC_MSG_NOTICE([Building libsass ($VERSION)])

Expand Down
5 changes: 1 addition & 4 deletions sass.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,8 @@

#endif

#ifndef LIBSASS_VERSION
#define LIBSASS_VERSION "[NA]"
#endif

// include API headers
#include "sass_version.h"
#include "sass_values.h"
#include "sass_functions.h"

Expand Down
8 changes: 8 additions & 0 deletions sass_version.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#ifndef SASS_VERSION_H
#define SASS_VERSION_H

#ifndef LIBSASS_VERSION
#define LIBSASS_VERSION "[NA]"
#endif

#endif
8 changes: 8 additions & 0 deletions sass_version.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#ifndef SASS_VERSION_H
#define SASS_VERSION_H

#ifndef LIBSASS_VERSION
#define LIBSASS_VERSION "@PACKAGE_VERSION@"
#endif

#endif

0 comments on commit b287d31

Please sign in to comment.