Skip to content

Commit

Permalink
fixup some autotools things
Browse files Browse the repository at this point in the history
  • Loading branch information
ohanar committed May 24, 2015
1 parent 10c5129 commit 1621688
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 9 deletions.
2 changes: 2 additions & 0 deletions common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ AM_CPPFLAGS = \

AM_CFLAGS = -std=c99
AM_CXXFLAGS = -std=c++98 -ftemplate-depth-100

AM_DEFAULT_SOURCE_EXT = .cc
51 changes: 44 additions & 7 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
AC_INIT([PolyBoRi], [0.8.4])

AC_CONFIG_MACRO_DIRS([m4])
AM_INIT_AUTOMAKE([foreign -Wall -Werror])
AM_INIT_AUTOMAKE([foreign -Wall -Werror tar-ustar])

AC_PROG_CC
AC_PROG_CXX
Expand All @@ -18,16 +18,14 @@ AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)

AC_CHECK_HEADER([unordered_map],[AC_DEFINE([PBORI_HAVE_UNORDERD_MAP],[],[has unordered map])])
if test "x$ac_cv_header_unordered_map" != xyes; then
if ! test "x$ac_cv_header_unordered_map" = xyes; then
AC_CHECK_HEADER([tr1/unordered_map],[AC_DEFINE([PBORI_HAVE_TR1_UNORDERED_MAP],[],[has tr1 unordered map])])
if test "x$ac_cv_header_tr1_unordered_map" != xyes; then
if ! test "x$ac_cv_header_tr1_unordered_map" = xyes; then
AC_CHECK_HEADER([ext/hash_map],[AC_DEFINE([PBORI_HAVE_HASH_MAP],[],[has hash map])])
fi
fi

AC_CHECK_HEADER([m4ri/m4ri.h],
[AC_DEFINE([PBORI_HAVE_M4RI],[],[has m4ri])],
[AC_MSG_ERROR([unable to find m4ri])])
PKG_CHECK_MODULES([M4RI], m4ri, [AC_DEFINE([PBORI_HAVE_M4RI],[],[has m4ri])])
AC_EGREP_CPP([pbori_have_m4ri_png],
[#include <m4ri/io.h>
#if defined(__M4RI_HAVE_LIBPNG)
Expand All @@ -36,7 +34,46 @@ AC_EGREP_CPP([pbori_have_m4ri_png],
#endif
#endif
],
[AC_DEFINE([PBORI_HAVE_M4RI_PNG],[],[has m4ri png support])])
[m4ri_png="yes"], [m4ri_png="no"])

if test "x$m4ri_png" = "xyes"; then
PKG_CHECK_MODULES([PNG], [libpng],
[have_libpng="yes"; LIBPNG_LIBADD="$PNG_LIBS"],
[AC_CHECK_LIB([png],
[png_create_write_struct],
[have_libpng="yes"; LIBPNG_LIBADD="-lpng"],
[AC_CHECK_LIB([png14],
[png_create_write_struct],
[have_libpng="yes"; LIBPNG_LIBADD="-lpng14"],
[AC_CHECK_LIB([png12],
[png_create_write_struct],
[have_libpng="yes"; LIBPNG_LIBADD="-lpng12"],
[AC_CHECK_LIB([png10],
[png_create_write_struct],
[have_libpng="yes"; LIBPNG_LIBADD="-lpng10"],
[have_libpng="no"])
])
])
])
])
fi

if test "x$have_libpng" = "xyes"; then
AC_SUBST(LIBPNG_LIBADD)
AC_DEFINE([PBORI_HAVE_M4RI_PNG],[],[has m4ri png support])
else
LIBPNG_LIBADD=""

PKG_CHECK_MODULES([GD], [gdlib],
[AC_CHECK_LIB([gd], [gdImagePng],
[have_gd="yes"],
[have_gd="no"])
])
if test "x$have_gd" = "xyes" ; then
AC_SUBST(GD_LIBS)
AC_DEFINE([PBORI_HAVE_GD],[],[has gd png support])
fi
fi

AC_CONFIG_HEADERS([libpolybori/include/polybori/config.h])
AC_CONFIG_FILES([
Expand Down
7 changes: 5 additions & 2 deletions groebner/src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ include $(top_srcdir)/common.mk

lib_LTLIBRARIES = libpolybori_groebner.la

libpolybori_groebner_la_LDFLAGS = -lpng12 -lm4ri
libpolybori_groebner_la_LIBADD = $(top_srcdir)/libpolybori.la
libpolybori_groebner_la_LIBADD = \
$(top_srcdir)/libpolybori.la \
$(LIBPNG_LIBADD) \
$(M4RI_LIBS) \
$(GD_LIBS)

libpolybori_groebner_la_SOURCES = \
dlex4data.cc \
Expand Down

0 comments on commit 1621688

Please sign in to comment.