-
Notifications
You must be signed in to change notification settings - Fork 18
/
configure.ac
156 lines (129 loc) · 4.42 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# Sally - A Tool for Embedding Strings in Vector Spaces
# Copyright (C) 2010-2015 Konrad Rieck ([email protected])
AC_INIT([sally], [1.0.0], [[email protected]])
AC_PREFIX_DEFAULT("/usr/local")
# Library version current:revision:age
# See http://developer.apple.com/documentation/developertools/glibtool/libtool_6.html
LIB_VERSION=1:1:1
echo
echo " .Oo Sally - A Tool for Embedding Strings in Vector Spaces"
echo " Copyright (c) 2010-2015 Konrad Rieck ([email protected])"
echo
# Init automake & config.h
AM_INIT_AUTOMAKE
AC_CONFIG_HEADER([config.h])
# Check for important programs
AC_PROG_CC
AC_PROG_LD
AC_PROG_INSTALL
# Libtool stuff
AC_CONFIG_MACRO_DIR(m4)
AC_PROG_LIBTOOL
# By default remove assert statements
CFLAGS="$CFLAGS -DNDEBUG"
# By default we include the math library
LIBS="$LIBS -lm"
# Set GCC and C99 flags if present
if test "$GCC" = "yes" ; then
CFLAGS="$CFLAGS -std=c99 -fgnu89-inline -Wall -fPIC"
fi
# Optional packages
AC_ARG_WITH([libarchive], [AS_HELP_STRING([--with-libarchive],
[support for reading archives @<:@default=check@:>@])],
[], [with_libarchive=check])
AC_ARG_WITH([openmp], [AS_HELP_STRING([--with-openmp],
[support for multi-processing @<:@default=check@:>@])],
[], [with_openmp=check])
# Check for zlib (required)
AC_CHECK_HEADERS([zlib.h], HEADER_ZLIB="yes")
AC_CHECK_LIB([z], gzopen, LIBRARY_ZLIB="yes")
if test "x$LIBRARY_ZLIB" != "x" && test "x$HEADER_ZLIB" != "x" ; then
LIBS="-lz $LIBS"
AC_DEFINE([HAVE_ZLIB], [1], [Define if you have zlib])
HAVE_ZLIB=yes
else
HAVE_ZLIB=no
AC_MSG_FAILURE([libz not found. see README.md])
fi
# Check for libarchive (optional)
AC_CHECK_HEADERS([archive.h], HEADER_LIBARCHIVE="yes")
AC_CHECK_LIB([archive], archive_read_new, LIBRARY_LIBARCHIVE="yes")
if test "x$LIBRARY_LIBARCHIVE" != "x" && \
test "x$HEADER_LIBARCHIVE" != "x" && \
test "x$with_libarchive" != "xno" ; then
AC_DEFINE([HAVE_LIBARCHIVE], [1], [Define if you have libarchive])
LIBS="-larchive $LIBS"
HAVE_LIBARCHIVE=yes
else
HAVE_LIBARCHIVE=no
if test "x$with_libarchive" == "xyes" ; then
AC_MSG_FAILURE([libarchive not found. see README.md])
fi
fi
# Check for libconfig (required)
AC_CHECK_HEADERS([libconfig.h], HEADER_LIBCONFIG="yes")
PKG_CHECK_MODULES([PKGCONFIG], [libconfig >= 1.3.2], LIBRARY_LIBCONFIG="yes")
if test "x$LIBRARY_LIBCONFIG" != "x" && test "x$HEADER_LIBCONFIG" != "x" ; then
CFLAGS="$CFLAGS $PKGCONFIG_CFLAGS"
LIBS="$LIBS $PKGCONFIG_LIBS"
AM_CPPFLAGS="$AM_CPPFLAGS `pkg-config --cflags-only-I libconfig`"
HAVE_LIBCONFIG=yes
AC_DEFINE([HAVE_LIBCONFIG], [1], [Define if you have libconfig])
else
HAVE_LIBCONFIG=no
AC_MSG_FAILURE([libconfig not found. see README.md])
fi
# Check for OpenMP (optional)
AC_CHECK_HEADERS([omp.h], HEADER_OPENMP="yes")
AX_OPENMP(LIBRARY_OPENMP="yes")
if test "x$LIBRARY_OPENMP" != "x" && \
test "x$HEADER_OPENMP" != "x" && \
test "x$with_openmp" != "xno" ; then
CFLAGS="$CFLAGS $OPENMP_CFLAGS"
HAVE_OPENMP=yes
AC_DEFINE([HAVE_OPENMP], [1], [Define if you have OpenMP])
else
HAVE_OPENMP=no
if test "x$with_openmp" == "xyes" ; then
AC_MSG_FAILURE([no openmp support. see README.md])
fi
fi
# Optional features
AC_ARG_ENABLE([md5hash], [AS_HELP_STRING([--enable-md5hash],
[enable MD5 hash function])],
[
AC_DEFINE([ENABLE_MD5HASH], [1], [Define if MD5 hash enabled])
ENABLE_MD5HASH=yes
], [ENABLE_MD5HASH=no])
AM_CONDITIONAL([ENABLE_MD5HASH], [test x$ENABLE_MD5HASH = xyes])
# Check headers
AC_CHECK_HEADERS([getopt.h string.h strings.h])
AC_CHECK_HEADERS([uthash.h uthash/uthash.h], HEADER_UTHASH="yes")
# Check functions
AC_CHECK_FUNC(log2, AC_DEFINE(HAVE_FUNC_LOG2, 1,
[Define to 1 if you have the function log2]))
AC_SUBST([AM_CPPFLAGS])
AC_SUBST([LIB_VERSION])
AC_CONFIG_FILES([
Makefile \
src/Makefile \
src/input/Makefile \
src/output/Makefile \
src/fvec/Makefile \
doc/Makefile \
tests/Makefile \
contrib/Makefile \
])
AC_OUTPUT_COMMANDS([],[
HAVE_OPENMP=$HAVE_OPENMP
HAVE_LIBARCHIVE=$HAVE_LIBARCHIVE
ENABLE_MD5HASH=$ENABLE_MD5HASH
])
AC_OUTPUT
echo
echo " .Oo Optional packages:"
echo " Support for reading archives (--with-libarchive): $HAVE_LIBARCHIVE"
echo " Support for multi-processing (--with-openmp): $HAVE_OPENMP"
echo " .Oo Optional features:"
echo " MD5 as alternative hash (--enable-md5hash): $ENABLE_MD5HASH"
echo