forked from JanX2/libxls
-
Notifications
You must be signed in to change notification settings - Fork 1
/
configure.in
116 lines (92 loc) · 2.95 KB
/
configure.in
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
AC_INIT([libxls],[1.2.1],[dhoerl@users.sourceforge.net])
AC_CONFIG_SRCDIR([test/test.c])
PACKAGE=libxls
LIBXLS_MAJOR_VERSION=1
LIBXLS_MINOR_VERSION=4
LIBXLS_MICRO_VERSION=0
VERSION=$LIBXLS_MAJOR_VERSION.$LIBXLS_MINOR_VERSION.$LIBXLS_MICRO_VERSION
VERSION_INFO=`expr $LIBXLS_MAJOR_VERSION + $LIBXLS_MINOR_VERSION`:$LIBXLS_MICRO_VERSION:$LIBXLS_MINOR_VERSION
AC_SUBST(VERSION_INFO)
AC_SUBST(LIBXLS_MAJOR_VERSION)
AC_SUBST(LIBXLS_MINOR_VERSION)
AC_SUBST(LIBXLS_MICRO_VERSION)
# Define those values into C code
AC_DEFINE_UNQUOTED([LIBXLS_MAJOR_VERSION],$LIBXLS_MAJOR_VERSION,[Major version])
AC_DEFINE_UNQUOTED([LIBXLS_MINOR_VERSION],$LIBXLS_MINOR_VERSION,[Minor version])
AC_DEFINE_UNQUOTED([LIBXLS_MICRO_VERSION],$LIBXLS_MICRO_VERSION,[Micro version])
AM_INIT_AUTOMAKE($PACKAGE,$VERSION)
AC_CONFIG_MACRO_DIR([m4])
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
AC_CONFIG_HEADERS([config.h])
AC_PREFIX_DEFAULT(/usr/local/libxls)
AC_PROG_INSTALL
AC_PROG_LIBTOOL
AC_PROG_CC
AC_PROG_CC_C99
AC_PROG_CXX
LT_INIT
AC_SUBST(LIBTOOL_DEPS)
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
AC_PROG_INSTALL
AC_CHECK_FUNCS([pow])
AC_CHECK_FUNCS([strdup])
AC_CHECK_FUNCS([asprintf])
AC_CHECK_HEADERS([wchar.h])
AC_C_CONST
AC_FUNC_MALLOC
AC_FUNC_REALLOC
LT_INIT
AC_TYPE_SIZE_T
# Comment out if your want assertions
AC_DEFINE([NDEBUG], [1], [Disables Assertions])
#AC_HEADER_ASSERT
WITH_ICONV=0
AC_ARG_WITH(iconv, [ --with-iconv[=DIR] add ICONV support (on)])
if test "$with_iconv" = "no" ; then
echo Disabling ICONV support
else
if test "$with_iconv" != "yes" -a "$with_iconv" != "" ; then
CPPFLAGS="${CPPFLAGS} -I$with_iconv/include"
# Export this since our headers include iconv.h
XML_INCLUDEDIR="${XML_INCLUDEDIR} -I$with_iconv/include"
ICONV_LIBS="-L$with_iconv/lib"
fi
AC_CHECK_HEADER(iconv.h,
AC_MSG_CHECKING(for iconv)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>
#include <iconv.h>]], [[
iconv_t cd = iconv_open ("","");
iconv (cd, NULL, NULL, NULL, NULL);]])],[
AC_MSG_RESULT(yes)
WITH_ICONV=1],[
AC_MSG_RESULT(no)
AC_MSG_CHECKING(for iconv in -liconv)
_ldflags="${LDFLAGS}"
_libs="${LIBS}"
LDFLAGS="${LDFLAGS} ${ICONV_LIBS}"
LIBS="${LIBS} -liconv"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>
#include <iconv.h>]], [[
iconv_t cd = iconv_open ("","");
iconv (cd, NULL, NULL, NULL, NULL);]])],[
AC_MSG_RESULT(yes)
WITH_ICONV=1
ICONV_LIBS="${ICONV_LIBS} -liconv"
LIBS="${_libs}"
LDFLAGS="${_ldflags}"],[
AC_MSG_RESULT(no)
LIBS="${_libs}"
LDFLAGS="${_ldflags}"])]))
fi
if test "$WITH_ICONV" = "1"; then
AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
fi
AC_SUBST(WITH_ICONV)
LIBXLS_LIBS="$ICONV_LIBS $LIBS"
AC_SUBST(LIBXLS_LIBS)
AC_CONFIG_FILES([Makefile include/Makefile include/libxls/Makefile src/Makefile test/Makefile])
AC_OUTPUT
AC_MSG_NOTICE([---])
AC_MSG_NOTICE([catdoc users: avoid xls2csv conflicts, use ./configure --program-prefix=lib to get libxls2csv])
AC_MSG_NOTICE([---])