From 871082dc018815261b6ec75a8e4933505389ffae Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 29 Apr 2014 08:29:49 +0200 Subject: Support for autotools and VC++ 9, 10, 11 build systems --- m4/diff.m4 | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++++ m4/disable-rpath.m4 | 25 +++++++++++++++++++++++++ m4/libexpat.m4 | 39 ++++++++++++++++++++++++++++++++++++++ m4/libtool-link.m4 | 46 +++++++++++++++++++++++++++++++++++++++++++++ m4/pkgconfig.m4 | 12 ++++++++++++ m4/static-lib.m4 | 18 ++++++++++++++++++ 6 files changed, 194 insertions(+) create mode 100644 m4/diff.m4 create mode 100644 m4/disable-rpath.m4 create mode 100644 m4/libexpat.m4 create mode 100644 m4/libtool-link.m4 create mode 100644 m4/pkgconfig.m4 create mode 100644 m4/static-lib.m4 (limited to 'm4') diff --git a/m4/diff.m4 b/m4/diff.m4 new file mode 100644 index 0000000..87b5d13 --- /dev/null +++ b/m4/diff.m4 @@ -0,0 +1,54 @@ +dnl file : m4/diff.m4 +dnl copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC +dnl license : MIT; see accompanying LICENSE file +dnl +dnl DIFF_TOOL +dnl +AC_DEFUN([DIFF_TOOL], [ +diff_found=no + +AC_ARG_VAR([DIFF],[diff command]) +AC_ARG_VAR([DIFFFLAGS],[diff flags]) + +AC_ARG_WITH( + [diff], + [AC_HELP_STRING([--with-diff=PATH],[path to the diff program])], + [diff_path=${withval}], + [diff_path=]) + +AC_MSG_CHECKING([for diff]) + +if test x"$DIFF" = x; then + if test x"$diff_path" != x; then + AS_SET_CATFILE([abs_diff_path], [$ac_pwd], [$diff_path]) + DIFF="$abs_diff_path" + else + DIFF=diff + fi +fi + +cat >conftest.txt + +$DIFF conftest.txt conftest.txt 2>/dev/null 1>&2 + +if test x"$?" = x0; then + AC_MSG_RESULT([$DIFF]) +else + AC_MSG_RESULT([no]) + AC_MSG_ERROR([diff command is not found; consider setting the DIFF variable or using --with-diff=PATH]) +fi + +AC_MSG_CHECKING([whether $DIFF accepts -u]) + +$DIFF -u conftest.txt conftest.txt 2>/dev/null 1>&2 + +if test x"$?" = x0; then + AC_MSG_RESULT([yes]) + DIFFFLAGS="$DIFFFLAGS -u" +else + AC_MSG_RESULT([no]) +fi + +rm -f conftest.txt + +])dnl diff --git a/m4/disable-rpath.m4 b/m4/disable-rpath.m4 new file mode 100644 index 0000000..68495b9 --- /dev/null +++ b/m4/disable-rpath.m4 @@ -0,0 +1,25 @@ +dnl file : m4/disable-rpath.m4 +dnl copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC +dnl license : MIT; see accompanying LICENSE file +dnl +AC_DEFUN([DISABLE_RPATH],[ + +AC_MSG_CHECKING([whether to use rpath]) +AC_ARG_ENABLE( + [rpath], + [AC_HELP_STRING([--disable-rpath], [patch libtool to not use rpath])], + [libtool_rpath="$enable_rpath"], + [libtool_rpath="yes"]) +AC_MSG_RESULT($libtool_rpath) + +# Patch libtool to not use rpath if requested. +# +AC_CONFIG_COMMANDS( + [libtool-rpath-patch], + [if test "$libtool_use_rpath" = "no"; then + sed < libtool > libtool-2 's/^hardcode_libdir_flag_spec.*$'/'hardcode_libdir_flag_spec=" -D__LIBTOOL_NO_RPATH__ "/' + mv libtool-2 libtool + chmod 755 libtool + fi], + [libtool_use_rpath=$libtool_rpath]) +])dnl diff --git a/m4/libexpat.m4 b/m4/libexpat.m4 new file mode 100644 index 0000000..67a9132 --- /dev/null +++ b/m4/libexpat.m4 @@ -0,0 +1,39 @@ +dnl file : m4/libexpat.m4 +dnl copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC +dnl license : MIT; see accompanying LICENSE file +dnl +dnl LIBEXPAT([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) +dnl +dnl +AC_DEFUN([LIBEXPAT], [ +libexpat_found=no + +AC_MSG_CHECKING([for expat]) + +save_LIBS="$LIBS" +LIBS="-lexpat $LIBS" + +CXX_LIBTOOL_LINK_IFELSE([ +AC_LANG_SOURCE([ +#include + +int +main () +{ + XML_Parser p (XML_ParserCreateNS (0, XML_Char (' '))); + XML_ParserFree (p); +} +])], +[ +libexpat_found=yes +]) + +if test x"$libexpat_found" = xyes; then + AC_MSG_RESULT([yes]) + [$1] +else + LIBS="$save_LIBS" + AC_MSG_RESULT([no]) + [$2] +fi +])dnl diff --git a/m4/libtool-link.m4 b/m4/libtool-link.m4 new file mode 100644 index 0000000..f02811f --- /dev/null +++ b/m4/libtool-link.m4 @@ -0,0 +1,46 @@ +dnl file : m4/libtool-link.m4 +dnl copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC +dnl license : MIT; see accompanying LICENSE file +dnl +dnl +dnl CXX_LIBTOOL_LINK_IFELSE (input, [action-if-true], [action-if-false]) +dnl +dnl Similar to AC_LINK_IFELSE except it uses libtool to perform the +dnl linking and it does this using the C++ compiler. +dnl +AC_DEFUN([CXX_LIBTOOL_LINK_IFELSE],[ +AC_LANG_SAVE +AC_LANG(C++) + +if test -d .libs; then + delete_libs_dir=no +else + delete_libs_dir=yes +fi + +AC_COMPILE_IFELSE([$1], +[ + ac_try='./libtool --tag=CXX --mode=link $CXX -no-install $CXXFLAGS $LDFLAGS -o conftest conftest.$OBJEXT $LIBS >&AS_MESSAGE_LOG_FD' + if _AC_DO_VAR(ac_try); then + libtool_link_ok=yes + else + libtool_link_ok=no + fi +], +[ + libtool_link_ok=no +]) + +if test x"$delete_libs_dir" = xyes; then + rm -rf .libs +fi + +if test x"$libtool_link_ok" = xyes; then +[$2] +: +else +[$3] +: +fi + +AC_LANG_RESTORE])dnl diff --git a/m4/pkgconfig.m4 b/m4/pkgconfig.m4 new file mode 100644 index 0000000..59439fc --- /dev/null +++ b/m4/pkgconfig.m4 @@ -0,0 +1,12 @@ +dnl file : m4/pkgconfig.m4 +dnl copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC +dnl license : MIT; see accompanying LICENSE file +dnl +AC_DEFUN([PKGCONFIG],[ +AC_ARG_WITH( + [pkgconfigdir], + [AC_HELP_STRING([--with-pkgconfigdir=DIR],[location of pkgconfig dir (default is libdir/pkgconfig)])], + [pkgconfigdir=${withval}], + [pkgconfigdir='${libdir}/pkgconfig']) +AC_SUBST([pkgconfigdir]) +])dnl diff --git a/m4/static-lib.m4 b/m4/static-lib.m4 new file mode 100644 index 0000000..802902a --- /dev/null +++ b/m4/static-lib.m4 @@ -0,0 +1,18 @@ +dnl file : m4/static-lib.m4 +dnl copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC +dnl license : MIT; see accompanying LICENSE file +dnl +dnl STATIC_LIB(MACRO, DESCRIPTION) +dnl +dnl Define MACRO if we are on MinGW and are only building static library. +dnl +AC_DEFUN([STATIC_LIB], +[ +if test x$enable_shared = xno; then + case $host_os in + mingw*) + AC_DEFINE([$1], [1], [$2]) + ;; + esac +fi +])dnl -- cgit v1.1