bump to 1.0.0 and clean up spec file
[platform/upstream/libical.git] / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2 AC_PREREQ(2.52)
3
4 AC_INIT([libical], [1.00], [http://freeassociation.sf.net/])
5 AC_CANONICAL_SYSTEM
6 AM_INIT_AUTOMAKE
7
8 AM_CONFIG_HEADER(config.h)
9
10 dnl  Initialize maintainer mode
11 AM_MAINTAINER_MODE
12
13 dnl Checks for programs.
14 AC_PROG_YACC
15 AC_PROG_CC
16 AC_PROG_CXX
17 AM_PROG_LEX
18 AC_PROG_LN_S
19 AC_PROG_INSTALL
20
21 dnl Initialize libtool
22 AM_PROG_LIBTOOL
23
24 AC_SUBST(AR)
25
26 dnl *** check for Win32
27
28 AC_MSG_CHECKING([whether the system provides zonefiles or we should bring our own? ])
29 case "$host" in
30 *-mingw*)
31     use_builtin_timezone=yes
32     os_win32=yes
33     ;;
34 *linux*)
35     use_builtin_timezone=no
36     os_win32=no
37     ;;
38 *kfreebsd*-gnu*)
39     use_builtin_timezone=no
40     os_win32=no
41     ;;
42 *)  
43     use_builtin_timezone=yes
44     os_win32=no
45     ;;
46 esac
47
48 if test "$use_builtin_timezone" = "no" ; then
49         if test ! -d /usr/share/zoneinfo; then
50             use_builtin_timezone=yes
51         fi
52 fi
53
54 AC_MSG_RESULT([$use_builtin_timezone])
55 AM_CONDITIONAL(OS_WIN32, [test $os_win32 = yes])
56
57 if test "x$os_win32" = "xyes"; then
58         zoneinfo_dir="zoneinfo"
59 fi
60
61 dnl should we override the system default?
62 AC_ARG_WITH(builtintz, [  --with-builtintz             deliver our own zonefiles?],
63                        [if test "x$withval" = "xyes" ; then
64                              use_builtin_timezone="yes"
65                           fi
66                           if test "x$withval" = "xno" ; then
67                              use_builtin_timezone="no"
68                           fi]
69                 )
70
71 zoneinfodir=""
72 if test "$use_builtin_timezone" = "yes"; then
73    AC_DEFINE(USE_BUILTIN_TZDATA, [], [whether we should bring our own TZ-Data])
74    zoneinfodir=zoneinfo
75 fi
76 AC_SUBST(ZONE_INFO, "$zoneinfodir")
77
78
79
80 dnl *** bdb4 support
81
82 AC_MSG_CHECKING(for Berkeley DB4 support)
83 AC_ARG_WITH(bdb4, [  --with-bdb4             Add support for Berkeley DB 4.0],
84 [case $with_bdb4 in  
85     yes)        AC_MSG_RESULT(yes)
86                 AC_MSG_RESULT(  Adding Berkeley DB support)
87                 WITH_BDB4="yes"
88                 ;;
89     no)         AC_MSG_RESULT(no)
90                 ;;
91     *)          AC_MSG_RESULT(no)
92                 AC_MSG_RESULT(Ignoring unknown argument to --with-bdb4: $with_bdb4)
93                 ;;
94 esac],
95 AC_MSG_RESULT(no))
96
97 if test x$WITH_BDB4 = xyes; then
98   AC_ARG_WITH(bdb4_dir, [  --with-bdb4-dir=PATH    Use PATH as location of BerkeleyDB 4.0],
99      BDB_DIR=$withval,
100      BDB_DIR=/usr/local/BerkeleyDB.4.0
101   )
102
103   AC_MSG_CHECKING(for Berkeley DB include files)
104   if test -f $BDB_DIR/include/db.h; then
105    BDB_DIR_INCLUDE=$BDB_DIR/include
106    AC_MSG_RESULT($BDB_DIR_INCLUDE)
107   else
108     if test -f $BDB_DIR/include/db4/db.h; then
109      BDB_DIR_INCLUDE=$BDB_DIR/include/db4
110      AC_MSG_RESULT($BDB_DIR_INCLUDE)
111     else
112      WITH_BDB4="no"
113      AC_MSG_RESULT(not found!)
114     fi
115   fi
116
117   AC_MSG_CHECKING(for Berkeley DB libraries)
118   if test -f $BDB_DIR/lib/libdb-4.0.la; then
119    BDB_DIR_LIB=$BDB_DIR/lib
120    BDB_LIB=libdb-4.0.la
121    AC_MSG_RESULT($BDB_DIR_LIB $BDB_LIB)
122   else
123     if test -f $BDB_DIR/lib/libdb4.la; then
124      BDB_DIR_LIB=$BDB_DIR/lib
125      BDB_LIB=libdb4.la
126      AC_MSG_RESULT($BDB_DIR_LIB $BDB_LIB)
127     else
128      WITH_BDB4="no"
129      AC_MSG_RESULT(not found!)
130     fi
131   fi
132
133   AC_SUBST(BDB_DIR)
134   AC_SUBST(BDB_DIR_INCLUDE)
135   AC_SUBST(BDB_DIR_LIB)
136   AC_SUBST(BDB_LIB)
137   dnl 4.0 is required...
138   BDB_VERSION="4.0"
139   AC_SUBST(BDB_VERSION)
140 fi
141 AM_CONDITIONAL(WITH_BDB4, test x$WITH_BDB4 = xyes)
142
143
144 dnl disable backtrace if we don't want it.
145 AC_ARG_WITH(backtrace, 
146                     [  --with-backtrace        enable backtrace dumps in the syslog],
147                         [ if test "x$withval" != "xno" ; then
148                              CFLAGS="$CFLAGS  -rdynamic "
149                              LDFLAGS="$LDFLAGS  -rdynamic "
150                              SERVER_LDFLAGS="$SERVER_LDFLAGS  -rdynamic "
151                              AC_CHECK_FUNCS(backtrace)
152                           fi
153                         ]
154 )
155
156 dnl *** Yacc/Bison support
157
158 AC_MSG_CHECKING(whether to support development)
159 AC_ARG_WITH(devel, [  --with-devel            Add development options],
160 [case $with_devel in  
161     yes)        DEV="yes"
162                 AC_MSG_RESULT(yes)
163                 AC_MSG_RESULT(Setting up for development: -Wall, flex, bison)
164                 AC_MSG_RESULT(** Note that you will need flex 2.5.7 or higher)
165                 ;;
166     no)         AC_MSG_RESULT(no)
167                 ;;
168     *)          AC_MSG_RESULT(no)
169                 AC_MSG_RESULT(Ignoring unknown argument to --with-devel: $with_devel)
170                 ;;
171 esac],
172 AC_MSG_RESULT(no))
173 AM_CONDITIONAL(DEV, test x$DEV = xyes)
174
175 AC_CHECK_PROGS(AR, ar aal, ar)
176 AC_CHECK_PROGS(PERL, perl5 perl)  
177
178 AC_MSG_CHECKING(whether to define _REENTRANT)
179 AC_ARG_ENABLE(reentrant, [  --enable-reentrant      define _REENTRANT to enable reentrant system calls],
180 [ case "${enableval}" in
181   no)
182     AC_MSG_RESULT(no)
183     ac_cv_reentrant=no
184     ;;
185   *) 
186     AC_MSG_RESULT(yes)
187     AC_DEFINE(ICAL_REENTRANT, ,[Define if we want _REENTRANT]) [CFLAGS="$CFLAGS -D_REENTRANT"]
188     ac_cv_reentrant=yes
189     ;;
190   esac ],
191   AC_MSG_RESULT(no)
192 )
193
194
195 dnl **************************************************
196 dnl ICAL_ERRORS_ARE_FATAL
197 dnl **************************************************
198 AC_MSG_CHECKING(if icalerrors_* calls should abort instead of internally signalling an error)
199 AC_ARG_ENABLE(icalerrors-are-fatal, 
200   [  --enable-icalerrors-are-fatal      define ICAL_ERRORS_ARE_FATAL to make icalerror_* calls fatal],
201   [  case "${enableval}" in
202         yes)
203           ac_cv_ical_errors_are_fatal=yes
204           ;;
205         *) 
206           ac_cv_ical_errors_are_fatal=no
207           ;;
208      esac ],
209   ac_cv_ical_errors_are_fatal=no
210 )
211 AC_MSG_RESULT($ac_cv_ical_errors_are_fatal)
212
213 if test "x$ac_cv_ical_errors_are_fatal" != "xyes"; then
214    AC_DEFINE(ICAL_ERRORS_ARE_FATAL, 0, [Define to make icalerror_* calls abort instead of internally signalling an error])
215 else
216    AC_DEFINE(ICAL_ERRORS_ARE_FATAL, 1, [Define to make icalerror_* calls abort instead of internally signalling an error])
217 fi
218
219 dnl **************************************************
220 dnl test/regression.c (and maybe others) needs this defined
221 dnl **************************************************
222 AC_DEFINE(NO_WARN_DEPRECATED,1,[Define to 1 if you DO NOT WANT to see deprecated messages])
223 AC_DEFINE(NO_WARN_ICAL_MALFORMEDDATA_ERROR_HACK,1,[Define to 1 if you DO NO WANT to see the warning messages related to ICAL_MALFORMEDDATA_ERROR and parsing .ics zoneinfo files])
224
225 AC_DEFINE(ICAL_UNIX_NEWLINE,1,[Define to terminate lines with "\n" instead of "\r\n"])
226 AC_DEFINE(ICAL_ALLOW_EMPTY_PROPERTIES,0,[Define to prevent empty properties from being replaced with X-LIC-ERROR properties])
227 dnl AC_DEFINE(ICAL_NO_EMPTY_ARRAY_DECL,1,[Define to 1 if your compile does not like lines like: struct something foo[]])
228
229 dnl Checks for libraries.
230 dnl Replace `main' with a function in -lical:
231 dnl AC_CHECK_LIB(ical, main)
232
233 dnl Check if this system can use pthreads
234 dnl HACK to support FreeBSD 4.x pthread
235
236 case "${host}" in 
237         *-*-freebsdelf4* )
238                 AC_MSG_RESULT(checking for pthread_create in -lpthread... -pthread (FreeBSD 4.x style))
239                 AC_DEFINE(HAVE_PTHREAD, ,[Define if we have pthread.])
240                 PTHREAD_LIBS=-pthread;;
241
242         *)
243         AC_CHECK_LIB(pthread,pthread_create,have_pthread=yes)
244         if test "x$have_pthread" = xyes; then
245            AC_DEFINE(HAVE_PTHREAD, ,[Define if we have pthread.])
246            PTHREAD_LIBS=-lpthread
247         fi;;
248 esac
249
250 AM_CONDITIONAL(HAVE_PTHREAD, test "$have_pthread" = "yes")
251 AC_SUBST(PTHREAD_LIBS)
252
253 dnl Checks for header files.
254 AC_HEADER_STDC
255 AC_CHECK_HEADERS(assert.h ctype.h pthread.h stdint.h time.h sys/types.h unistd.h wctype.h endian.h sys/endian.h byteswap.h)
256
257 dnl Checks for typedefs, structures, and compiler characteristics.
258 AC_C_CONST
259 AC_TYPE_SIZE_T
260 AC_TYPE_MODE_T
261 AC_CHECK_TYPE(intptr_t)
262 AC_STRUCT_TM
263
264 dnl Checks for library functions.
265 AC_CHECK_FUNCS(gmtime_r isspace iswspace strdup snprintf unsetenv setenv)
266
267 dnl **************************************************
268 dnl * Check for C++
269 dnl **************************************************
270
271 AC_ARG_ENABLE(cxx, 
272 [  --enable-cxx           Enable C++ bindings],,enable_cxx="no")
273 AM_CONDITIONAL(WITH_CXX_BINDINGS, test x$enable_cxx = "xyes")
274
275 AC_PREFIX_DEFAULT(/usr/local/libical)
276 if test "$prefix" = NONE; then
277         AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "$ac_default_prefix/share/libical", [where our self provided zonefiles should live])
278         ssl_dir="$ac_default_prefix/keys"
279 else
280         AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "$prefix/share/libical", [where our self provided zonefiles should live])
281 fi
282
283 dnl **************************************************
284 dnl * Check for Java
285 dnl **************************************************
286
287 AC_ARG_ENABLE(java, 
288 [  --enable-java          Enable Java bindings],,enable_java="no")
289 if test "x$enable_java" = "xyes"; then
290   AC_PATH_PROG(JAR, jar, /usr/local/bin/jar, /usr/local/bin:$PATH)
291   AC_PATH_PROG(JAVA, java, /usr/local/bin/java, /usr/local/bin:$PATH)
292   AC_PATH_PROG(JAVAC, javac, /usr/local/bin/javac, /usr/local/bin:$PATH)
293   AC_PATH_PROG(JAVAH, javah, /usr/local/bin/javah, /usr/local/bin:$PATH)
294   AC_SUBST(JAR)
295   AC_SUBST(JAVA)
296   AC_SUBST(JAVAC)
297   AC_SUBST(JAVAH)
298
299   dnl truly gross
300
301   case "${host}" in
302         *-*-solaris*)   JAVA_PLATFORM="solaris" ;;
303         *-*-linux*)     JAVA_PLATFORM="linux" ;;
304         *-*-freebsd*)   JAVA_PLATFORM="bsd" ;;
305         *-*-aix*)       JAVA_PLATFORM="aix" ;;
306         *-sequent-*)    JAVA_PLATFORM="ptx" ;;
307         *-*-hpux*)      JAVA_PLATFORM="hpux" ;;
308         *-*-irix*)      JAVA_PLATFORM="irix" ;;
309         *-*-os390*)     JAVA_PLATFORM="os390" ;;
310         *-*-os400*)     JAVA_PLATFORM="os400" ;;
311         *-apple-darwin*|*-apple-rhapsody*)      JAVA_PLATFORM="darwin" ;;
312         *)              JAVA_PLATFORM="unknown" ;;
313   esac
314
315   AC_SUBST(JAVA_PLATFORM)
316 fi
317 enable_java=no
318 AM_CONDITIONAL(WITH_JAVA, test x$enable_java = "xyes")
319
320 dnl **************************************************
321 dnl * Check for Python
322 dnl **************************************************
323 python_val=false
324 AC_ARG_ENABLE(python, 
325 [  --enable-python         Enable python bindings],,enable_python="no")
326
327 if test "x$enable_python" = "xyes"; then
328   AM_PATH_PYTHON([2.3], , [:])
329   AM_CONDITIONAL([HAVE_PYTHON], [test "$PYTHON" != :])
330   AC_CHECK_PROG(swig_val, swig, true, false)
331   AM_CONDITIONAL([HAVE_SWIG], [test "x$swig_val" = "xtrue"])
332   
333   PY_PREFIX=`$PYTHON -c 'import sys ; print sys.prefix'`
334   AC_CHECK_HEADER([python$PYTHON_VERSION/Python.h],[],[AC_MSG_ERROR([Can't find python header files])])
335   if test -f "$PY_PREFIX/include/python$PYTHON_VERSION/Python.h"; then
336     
337     PY_CFLAGS="-I$PY_PREFIX/include/python$PYTHON_VERSION"
338     AC_SUBST(PY_CFLAGS)
339     
340     # SWIG needs PIC in order to work.
341     CFLAGS="$CFLAGS -fPIC"
342   fi
343   
344   AC_CONFIG_FILES([src/python/Makefile])
345 else
346   AM_CONDITIONAL([HAVE_PYTHON], false)
347   AM_CONDITIONAL([HAVE_SWIG], false)
348 fi
349
350 if test "$use_builtin_timezone" = "yes"; then
351   AC_CONFIG_FILES([zoneinfo/Makefile])
352 fi
353
354 AC_CONFIG_FILES([Makefile])
355 AC_CONFIG_FILES([design-data/Makefile])
356 AC_CONFIG_FILES([doc/Makefile])
357 AC_CONFIG_FILES([examples/Makefile])
358 AC_CONFIG_FILES([scripts/Makefile])
359 AC_CONFIG_FILES([src/Makefile])
360 AC_CONFIG_FILES([src/libical/Makefile])
361 AC_CONFIG_FILES([src/libical/icalversion.h])
362 AC_CONFIG_FILES([src/libical/icalerror.h])
363 AC_CONFIG_FILES([src/libicalss/Makefile])
364 AC_CONFIG_FILES([src/libicalvcal/Makefile])
365 AC_CONFIG_FILES([src/test/Makefile])
366 AC_CONFIG_FILES([test-data/Makefile])
367 AC_CONFIG_FILES([libical.pc])
368
369 AC_OUTPUT