summaryrefslogtreecommitdiffstats
path: root/debian/opensync/opensync-0.22/configure.in
blob: 174e19242dee83c49874e0b44dfa513019ce1e16 (plain)
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
dnl Process this file with autoconf to produce a configure script.

AC_PREREQ(2.58)
AC_INIT(OpenSync, 0.22, [], libopensync)
AC_CONFIG_SRCDIR([opensync/opensync.h])
AM_INIT_AUTOMAKE(foreign)
AM_CONFIG_HEADER(config.h)

#### Defaults #####
WITH_DEBUG=yes
WITH_TRACE=yes
ENABLE_ENGINE=yes
ENABLE_TESTS=no
WITH_TOOLS=yes
WITH_PROF=no

AC_ISC_POSIX
AC_PROG_CC
AM_PROG_CC_STDC
AC_HEADER_STDC
AC_DISABLE_STATIC
AC_PROG_LIBTOOL
AC_PROG_YACC

OPENSYNC_CONFIGDIR=${datadir}/opensync/defaults
AC_SUBST(OPENSYNC_CONFIGDIR)

OPENSYNC_PLUGINDIR=${libdir}/opensync/plugins
AC_SUBST(OPENSYNC_PLUGINDIR)

OPENSYNC_FORMATSDIR=${libdir}/opensync/formats
AC_SUBST(OPENSYNC_FORMATSDIR)

OPENSYNC_HEADERDIR=${includedir}/opensync-1.0/opensync
AC_SUBST(OPENSYNC_HEADERDIR)

OPENSYNC_ENGINEHEADERDIR=${includedir}/opensync-1.0/osengine
AC_SUBST(OPENSYNC_ENGINEHEADERDIR)

AS_AC_EXPAND(OSPLUGIN, $libexecdir/osplugin)
AC_DEFINE_UNQUOTED(OSPLUGIN, ["${OSPLUGIN}"], [Full path to osplugin binary])

AC_ARG_ENABLE(engine,
  AS_HELP_STRING([--enable-engine], [enable building of the opensync engine]),
  ENABLE_ENGINE=$enableval)
if test "x${ENABLE_ENGINE}" = "xyes"; then
	AC_DEFINE(BUILD_ENGINE,1,[Stress Testing])
fi
AC_SUBST(BUILD_ENGINE)
AM_CONDITIONAL(BUILD_ENGINE, test x$ENABLE_ENGINE = xyes)

AC_ARG_ENABLE(debug,
  AS_HELP_STRING([--enable-debug], [enable debug messages]),
  WITH_DEBUG=$enableval)
if test "x${WITH_DEBUG}" = "xyes"; then
	AC_DEFINE(ENABLE_DEBUG,1,[Debugging])
	AC_SUBST(ENABLE_DEBUG)
fi

AC_ARG_ENABLE(tracing,
  AS_HELP_STRING([--enable-tracing], [enable tracing]),
  WITH_TRACE=$enableval)
if test "x${WITH_TRACE}" = "xyes"; then
	AC_DEFINE(ENABLE_TRACE,1,[Tracing])
	AC_SUBST(ENABLE_TRACE)
fi

AC_ARG_ENABLE(profiling,
  AS_HELP_STRING([--enable-profiling], [enable code profiling]),
  WITH_PROF=$enableval)
if test "x${WITH_PROF}" = "xyes"; then
	GCOV_CFLAGS=" -I/usr/lib/tau/include -DPROFILING_ON -DTAU_STDCXXLIB -DTAU_GNU -DTAU_DOT_H_LESS_HEADERS -fPIC -DPTHREADS"
	GCOV_LDFLAGS=" -L/usr/lib/tau/i386_linux/lib -ltau-pthread -lstdc++"
	AC_DEFINE(ENABLE_PROF,1,[Profiling])
else
	GCOV_CFLAGS=""
	GCOV_LDFLAGS=""
fi
AC_SUBST(GCOV_CFLAGS)
AC_SUBST(GCOV_LDFLAGS)
AM_CONDITIONAL(ENABLE_PROF, test "x${WITH_PROF}" = "xyes")

AC_ARG_ENABLE(tools,
  AS_HELP_STRING([--enable-tools], [enables building of the tools]),
  WITH_TOOLS=$enableval)
AM_CONDITIONAL(ENABLE_TOOLS, test "x${WITH_TOOLS}" = "xyes")

#### Check for libxml ####
PKG_CHECK_MODULES(XML, [libxml-2.0])
AC_SUBST(XML_CFLAGS)
AC_SUBST(XML_LIBS)

#### Check for unit tests ####
AC_ARG_ENABLE(unit-tests,
  AS_HELP_STRING([--enable-unit-tests], [enable unit tests]),
  ENABLE_TESTS=$enableval)
testdir=""
if test "x${ENABLE_TESTS}" = "xyes"; then
	AC_CHECK_HEADER(check.h,HAVE_CHECK=1,HAVE_CHECK=0)
	if test "x${HAVE_CHECK}" = "x1"; then
		AM_PATH_CHECK(0.9.0)
	fi

fi
AM_CONDITIONAL(ENABLE_TESTS, test x$HAVE_CHECK = x1)

#### Check for Python and Swig ####
#(need python, python headers, and pyrex)
AC_ARG_ENABLE(python,           
  AS_HELP_STRING([--enable-python@<:@=minimum_version@:>@], [build python bindings]),
  [enable_python=$enableval], [enable_python=auto])
 
if test x$enable_python = xno; then
    have_python=no
else
    AC_MSG_NOTICE([Checking to see if we can build Python bindings])
    have_python=no
    if test x$enable_python != xyes -a x$enable_python != xauto; then
        minimum_version=$enable_python
	enable_python=yes
    else
        minimum_version=2.2
    fi
	AM_PATH_PYTHON($minimum_version)
	AM_CHECK_PYTHON_HEADERS([have_python_header=yes], [have_python_header=no])
	
	if test x$have_python_header = xno ; then
        if test x$enable_python = xyes ; then
        	AC_MSG_ERROR([Building python explicitly requested, but can't build python bindings])
        fi
	else
	    if test -z "$PYTHON" ; then
	        AC_MSG_WARN([Python not found])
	    else
			AC_PROG_SWIG(1.3.17)
			SWIG_PYTHON
			if test x$SWIG_LIB = x; then
				have_python=no
			else
				have_python=yes
			fi
	    fi
	
	    if test x$have_python = xno ; then
	        if test x$enable_python = xyes ; then
	            AC_MSG_ERROR([Building python explicitly requested, but can't build python bindings])
	        fi
	    fi
	fi
fi
AM_CONDITIONAL(HAVE_PYTHON, test x$have_python = xyes)

#### Check for glib and sqlite ####
pkg_modules="glib-2.0 gmodule-2.0 gobject-2.0 gthread-2.0 sqlite3"
PKG_CHECK_MODULES(PACKAGE, [$pkg_modules])
AC_SUBST(PACKAGE_CFLAGS)
AC_SUBST(PACKAGE_LIBS)

# Workaround for autoconf 2.58, in which abs_builddir/abs_srcdir are not
# absolute at all.
# These are used in *-uninstalled.pc.in
AC_SUBST(ac_workaround_abs_builddir, $PWD) # builddir is defined as '.'
AC_SUBST(ac_workaround_abs_srcdir, $PWD/$srcdir)

#### Check for Solaris (SunOS) ####
OS=`uname|sed -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
if test "$OS" = "sunos"; then
	AC_MSG_NOTICE([OS Solaris detected])
	AC_DEFINE([SOLARIS], [], [Compiling on Solaris])
else
	if test "$OS" = "linux"; then
            AC_MSG_NOTICE([OS Linux detected])
	    AC_DEFINE([LINUX], [], [Compiling on Linux])
	else
            AC_MSG_NOTICE([Unknown OS detected])
	fi
fi


AC_OUTPUT([
Makefile
opensync/Makefile
tools/Makefile
tests/Makefile
tests/mock-plugin/Makefile
formats/Makefile
formats/vformats-xml/Makefile
osengine/Makefile
osplugin/Makefile
opensync-1.0.pc
opensync-1.0-uninstalled.pc
osengine-1.0.pc
osengine-1.0-uninstalled.pc
Doxyfile
wrapper/Makefile
])


# AC_OPENSYNC_ISENABLED(NAME, VARIABLE, [TESTFOR = yes])
AC_DEFUN([AC_OPENSYNC_ISENABLED],
[
if test "$3"; then
	ac_opensync_isenabled_testfor="$3"
else
	ac_opensync_isenabled_testfor="yes"
fi

if test "x${$2}" = "x${ac_opensync_isenabled_testfor}"; then
	echo "AS_HELP_STRING([$1:], Enabled)"
else
	echo "AS_HELP_STRING([$1:], Disabled)"
fi
])

echo ""
echo "========================================"
AC_OPENSYNC_ISENABLED([Python Bindings], have_python)
AC_OPENSYNC_ISENABLED([Unit Tests], ENABLE_TESTS)
AC_OPENSYNC_ISENABLED([Debug messages], WITH_DEBUG)
AC_OPENSYNC_ISENABLED([Tracing], WITH_TRACE)
AC_OPENSYNC_ISENABLED([Profiling], WITH_PROF)
AC_OPENSYNC_ISENABLED([Sync Engine], ENABLE_ENGINE)
AC_OPENSYNC_ISENABLED([Tools], WITH_TOOLS)
echo
echo "Now build opensync and install it."
echo "Afterwards go into the plugins directory"
echo "and build the plugins you need."
echo "========================================"