1AC_INIT(libwfut, 0.2.3, erik@ogenvik.org)
2
3AC_CONFIG_MACRO_DIR([m4])
4AC_CONFIG_SRCDIR([libwfut/WFUT.cpp])
5AC_CONFIG_HEADERS([config.h])
6
7AC_CANONICAL_HOST
8AM_INIT_AUTOMAKE([tar-ustar nostdinc dist-bzip2])
9AM_SILENT_RULES([yes])
10
11AC_CHECK_TOOL(SWIG, swig)
12
13LIBWFUT_CURRENT=2   ## Increment if interface changes
14LIBWFUT_REVISION=1  ## Increment if source changes. 0 if current is incremented
15LIBWFUT_AGE=1       ## Increment if current is incremented, but interface is
16                    ## backwards compatible
17
18AC_PROG_CXX
19AC_PROG_LIBTOOL
20
21
22AC_ARG_ENABLE(debug,
23  [  --enable-debug     enable debug information [default=no]],
24  [
25    if test "$enableval" = "yes"; then
26      CXXFLAGS="$CXXFLAGS -ggdb -O0 -DDEBUG"
27    else
28      CXXFLAGS="$CXXFLAGS -O3 -DNDEBUG"
29    fi
30  ],[
31    CXXFLAGS="$CXXFLAGS -O3 -DNDEBUG"
32  ]
33)
34
35
36## Tell Tiny XML to use STL classes.
37CXXFLAGS="$CXXFLAGS -DTIXML_USE_STL=1"
38
39AC_LANG_PUSH(C++)
40
41PKG_CHECK_MODULES(SIGC, sigc++-2.0 != 2.0.8,
42    [
43        CXXFLAGS="$CXXFLAGS $SIGC_CFLAGS"
44        LDFLAGS="$LDFLAGS $SIGC_LIBS"
45        LIBWFUT_REQUIRES="$LIBWFUT_REQUIRES sigc++-2.0"
46    ],
47    [
48        AC_MSG_ERROR([Couldn't find sigc++ library, or an invalid version was found. Please see http://libsigc.sourceforge.net/ and obtain sigc++ 2.0.])
49    ]
50)
51
52CURL_VERSION=7.15.0
53PKG_CHECK_MODULES(CURL, libcurl >= $CURL_VERSION,
54    [
55        CXXFLAGS="$CXXFLAGS $CURL_CFLAGS"
56        LDFLAGS="$LDFLAGS $CURL_LIBS"
57        LIBWFUT_REQUIRES="$LIBWFUT_REQUIRES libcurl"
58    ],
59    [
60        AC_MSG_ERROR([Couldn't find curl library. Please see http://curl.haxx.se/ and obtain a curl version greater than $CURL_VERSION])
61    ]
62)
63
64PKG_CHECK_MODULES(CURL_PIPE, libcurl >= 7.16.0,
65[
66	AC_DEFINE(HAVE_CURL_MULTI_PIPELINING, 1, [Define if curl is recent enough to have the pipelining option.])
67],
68	UNUSED=1
69]
70)
71
72# Try to find system-wide installation of tinyxml
73# If found, add define to config.h, set LIBS and add automake conditional
74AC_CHECK_LIB(tinyxml, main,
75	[
76		AC_DEFINE(HAVE_LIBTINYXML, 1, [Define to 1 if you have the `tinyxml' library (-ltinyxml).])
77		LIBS="-ltinyxml $LIBS"
78		have_tinyxml=true
79	],
80	[
81		have_tinyxml=false
82	]
83)
84AM_CONDITIONAL(HAVE_LIBTINYXML, [test x$have_tinyxml = xtrue])
85
86AC_LANG_POP(C++)
87
88AC_CHECK_LIB(z, crc32, [], [AC_MSG_ERROR([Unable to find zlib])])
89
90AC_SUBST(CFLAGS)
91AC_SUBST(CXXFLAGS)
92AC_SUBST(CPPFLAGS)
93AC_SUBST(LDFLAGS)
94
95LIBWFUT_LIB_SUFFIX="-0.2"
96LIBWFUT_LIBS="-lwfut$LIBWFUT_LIB_SUFFIX"
97LIBWFUT_VERSION_INFO=$LIBWFUT_CURRENT:$LIBWFUT_REVISION:$LIBWFUT_AGE
98
99AC_SUBST(LIBWFUT_LIB_SUFFIX)
100AC_SUBST(LIBWFUT_LIBS)
101AC_SUBST(LIBWFUT_REQUIRES)
102AC_SUBST(LIBWFUT_VERSION_INFO)
103
104
105# make python binding?
106AC_ARG_WITH([python], AS_HELP_STRING([--without-python], [build without Python bindings (default: test)]))
107
108if test "x$with_python" != "xno"; then
109  AM_PATH_PYTHON(2.2,,
110    [with_python=no
111     AC_MSG_WARN([Python not found; disabling Python binding])])
112fi
113
114if test "x$with_python" != "xno"; then
115  AM_CHECK_PYTHON_HEADERS(,
116    [with_python=no
117     AC_MSG_WARN([Python headers not found])])
118fi
119
120# need SWIG too
121if test "x$with_python" != "xno"; then
122  AC_CHECK_PROG(HAVE_SWIG, swig, [yes])
123
124  if test "x$HAVE_SWIG" != "xyes"; then
125    with_python=no
126    AC_MSG_WARN([SWIG not found; disabling Python binding])
127  else
128    with_python=yes
129  fi
130fi
131
132if test "x$with_python" = "xyes"; then
133  AM_CONDITIONAL(HAVE_PYTHON, true)
134else
135  AM_CONDITIONAL(HAVE_PYTHON, false)
136fi
137
138
139
140if test "$enable_shared" = yes; then
141  if test "x$CYGWIN" = xyes -o "x$MINGW32" = xyes; then
142    LIBWFUT_DLL=libwfut$LIBWFUT_LIB_SUFFIX.dll
143    AC_SUBST(LIBWFUT_DLL)
144    AC_CHECK_TOOL(DLLWRAP, dllwrap)
145    AC_CHECK_TOOL(DLLTOOL, dlltool)
146    BUILD_IT=true
147  else
148    BUILD_IT=false
149  fi
150else
151  BUILD_IT=false
152fi
153
154AM_CONDITIONAL(BUILD_DLL, test $BUILD_IT = true, true, false)
155AC_SUBST(BUILD_IT)
156
157AC_CONFIG_FILES([
158	libwfut.spec
159	libwfut-0.2.pc
160	Makefile
161	libwfut/Makefile
162	tools/Makefile
163	man/Makefile
164	man/man1/Makefile
165	python/Makefile
166])
167AC_OUTPUT
168