summaryrefslogtreecommitdiff
path: root/configure.in
blob: a6c94e02e2f67173ee23a1aa00b079823d57b626 (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
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.52)

AC_INIT([libical], [1.00], [http://freeassociation.sf.net/])
AC_CANONICAL_SYSTEM
AM_INIT_AUTOMAKE

AM_CONFIG_HEADER(config.h)

dnl  Initialize maintainer mode
AM_MAINTAINER_MODE

dnl Checks for programs.
AC_PROG_YACC
AC_PROG_CC
AC_PROG_CXX
AM_PROG_LEX
AC_PROG_LN_S
AC_PROG_INSTALL

dnl Initialize libtool
AM_PROG_LIBTOOL

AC_SUBST(AR)

dnl *** check for Win32

AC_MSG_CHECKING([whether the system provides zonefiles or we should bring our own? ])
case "$host" in
*-mingw*)
    use_builtin_timezone=yes
    os_win32=yes
    ;;
*linux*)
    use_builtin_timezone=no
    os_win32=no
    ;;
*kfreebsd*-gnu*)
    use_builtin_timezone=no
    os_win32=no
    ;;
*)  
    use_builtin_timezone=yes
    os_win32=no
    ;;
esac

if test "$use_builtin_timezone" = "no" ; then
   	if test ! -d /usr/share/zoneinfo; then
            use_builtin_timezone=yes
	fi
fi

AC_MSG_RESULT([$use_builtin_timezone])
AM_CONDITIONAL(OS_WIN32, [test $os_win32 = yes])

if test "x$os_win32" = "xyes"; then
	zoneinfo_dir="zoneinfo"
fi

dnl should we override the system default?
AC_ARG_WITH(builtintz, [  --with-builtintz             deliver our own zonefiles?],
		       [if test "x$withval" = "xyes" ; then
			     use_builtin_timezone="yes"
			  fi
			  if test "x$withval" = "xno" ; then
			     use_builtin_timezone="no"
			  fi]
		)

zoneinfodir=""
if test "$use_builtin_timezone" = "yes"; then
   AC_DEFINE(USE_BUILTIN_TZDATA, [], [whether we should bring our own TZ-Data])
   zoneinfodir=zoneinfo
fi
AC_SUBST(ZONE_INFO, "$zoneinfodir")



dnl *** bdb4 support

AC_MSG_CHECKING(for Berkeley DB4 support)
AC_ARG_WITH(bdb4, [  --with-bdb4             Add support for Berkeley DB 4.0],
[case $with_bdb4 in  
    yes)	AC_MSG_RESULT(yes)
		AC_MSG_RESULT(  Adding Berkeley DB support)
		WITH_BDB4="yes"
		;;
    no)		AC_MSG_RESULT(no)
		;;
    *)		AC_MSG_RESULT(no)
		AC_MSG_RESULT(Ignoring unknown argument to --with-bdb4: $with_bdb4)
		;;
esac],
AC_MSG_RESULT(no))

if test x$WITH_BDB4 = xyes; then
  AC_ARG_WITH(bdb4_dir, [  --with-bdb4-dir=PATH    Use PATH as location of BerkeleyDB 4.0],
     BDB_DIR=$withval,
     BDB_DIR=/usr/local/BerkeleyDB.4.0
  )

  AC_MSG_CHECKING(for Berkeley DB include files)
  if test -f $BDB_DIR/include/db.h; then
   BDB_DIR_INCLUDE=$BDB_DIR/include
   AC_MSG_RESULT($BDB_DIR_INCLUDE)
  else
    if test -f $BDB_DIR/include/db4/db.h; then
     BDB_DIR_INCLUDE=$BDB_DIR/include/db4
     AC_MSG_RESULT($BDB_DIR_INCLUDE)
    else
     WITH_BDB4="no"
     AC_MSG_RESULT(not found!)
    fi
  fi

  AC_MSG_CHECKING(for Berkeley DB libraries)
  if test -f $BDB_DIR/lib/libdb-4.0.la; then
   BDB_DIR_LIB=$BDB_DIR/lib
   BDB_LIB=libdb-4.0.la
   AC_MSG_RESULT($BDB_DIR_LIB $BDB_LIB)
  else
    if test -f $BDB_DIR/lib/libdb4.la; then
     BDB_DIR_LIB=$BDB_DIR/lib
     BDB_LIB=libdb4.la
     AC_MSG_RESULT($BDB_DIR_LIB $BDB_LIB)
    else
     WITH_BDB4="no"
     AC_MSG_RESULT(not found!)
    fi
  fi

  AC_SUBST(BDB_DIR)
  AC_SUBST(BDB_DIR_INCLUDE)
  AC_SUBST(BDB_DIR_LIB)
  AC_SUBST(BDB_LIB)
  dnl 4.0 is required...
  BDB_VERSION="4.0"
  AC_SUBST(BDB_VERSION)
fi
AM_CONDITIONAL(WITH_BDB4, test x$WITH_BDB4 = xyes)


dnl disable backtrace if we don't want it.
AC_ARG_WITH(backtrace, 
		    [  --with-backtrace        enable backtrace dumps in the syslog],
			[ if test "x$withval" != "xno" ; then
			     CFLAGS="$CFLAGS  -rdynamic "
			     LDFLAGS="$LDFLAGS  -rdynamic "
			     SERVER_LDFLAGS="$SERVER_LDFLAGS  -rdynamic "
                             AC_CHECK_FUNCS(backtrace)
			  fi
			]
)

dnl *** Yacc/Bison support

AC_MSG_CHECKING(whether to support development)
AC_ARG_WITH(devel, [  --with-devel            Add development options],
[case $with_devel in  
    yes)	DEV="yes"
		AC_MSG_RESULT(yes)
		AC_MSG_RESULT(Setting up for development: -Wall, flex, bison)
		AC_MSG_RESULT(** Note that you will need flex 2.5.7 or higher)
		;;
    no)		AC_MSG_RESULT(no)
		;;
    *)		AC_MSG_RESULT(no)
		AC_MSG_RESULT(Ignoring unknown argument to --with-devel: $with_devel)
		;;
esac],
AC_MSG_RESULT(no))
AM_CONDITIONAL(DEV, test x$DEV = xyes)

AC_CHECK_PROGS(AR, ar aal, ar)
AC_CHECK_PROGS(PERL, perl5 perl)  

AC_MSG_CHECKING(whether to define _REENTRANT)
AC_ARG_ENABLE(reentrant, [  --enable-reentrant      define _REENTRANT to enable reentrant system calls],
[ case "${enableval}" in
  no)
    AC_MSG_RESULT(no)
    ac_cv_reentrant=no
    ;;
  *) 
    AC_MSG_RESULT(yes)
    AC_DEFINE(ICAL_REENTRANT, ,[Define if we want _REENTRANT]) [CFLAGS="$CFLAGS -D_REENTRANT"]
    ac_cv_reentrant=yes
    ;;
  esac ],
  AC_MSG_RESULT(no)
)


dnl **************************************************
dnl ICAL_ERRORS_ARE_FATAL
dnl **************************************************
AC_MSG_CHECKING(if icalerrors_* calls should abort instead of internally signalling an error)
AC_ARG_ENABLE(icalerrors-are-fatal, 
  [  --enable-icalerrors-are-fatal      define ICAL_ERRORS_ARE_FATAL to make icalerror_* calls fatal],
  [  case "${enableval}" in
	yes)
	  ac_cv_ical_errors_are_fatal=yes
	  ;;
	*) 
	  ac_cv_ical_errors_are_fatal=no
	  ;;
     esac ],
  ac_cv_ical_errors_are_fatal=no
)
AC_MSG_RESULT($ac_cv_ical_errors_are_fatal)

if test "x$ac_cv_ical_errors_are_fatal" != "xyes"; then
   AC_DEFINE(ICAL_ERRORS_ARE_FATAL, 0, [Define to make icalerror_* calls abort instead of internally signalling an error])
else
   AC_DEFINE(ICAL_ERRORS_ARE_FATAL, 1, [Define to make icalerror_* calls abort instead of internally signalling an error])
fi

dnl **************************************************
dnl test/regression.c (and maybe others) needs this defined
dnl **************************************************
AC_DEFINE(NO_WARN_DEPRECATED,1,[Define to 1 if you DO NOT WANT to see deprecated messages])
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])

AC_DEFINE(ICAL_UNIX_NEWLINE,1,[Define to terminate lines with "\n" instead of "\r\n"])
AC_DEFINE(ICAL_ALLOW_EMPTY_PROPERTIES,0,[Define to prevent empty properties from being replaced with X-LIC-ERROR properties])
dnl AC_DEFINE(ICAL_NO_EMPTY_ARRAY_DECL,1,[Define to 1 if your compile does not like lines like: struct something foo[]])

dnl Checks for libraries.
dnl Replace `main' with a function in -lical:
dnl AC_CHECK_LIB(ical, main)

dnl Check if this system can use pthreads
dnl HACK to support FreeBSD 4.x pthread

case "${host}" in 
        *-*-freebsdelf4* )
		AC_MSG_RESULT(checking for pthread_create in -lpthread... -pthread (FreeBSD 4.x style))
		AC_DEFINE(HAVE_PTHREAD, ,[Define if we have pthread.])
		PTHREAD_LIBS=-pthread;;

	*)
	AC_CHECK_LIB(pthread,pthread_create,have_pthread=yes)
	if test "x$have_pthread" = xyes; then
	   AC_DEFINE(HAVE_PTHREAD, ,[Define if we have pthread.])
	   PTHREAD_LIBS=-lpthread
	fi;;
esac

AM_CONDITIONAL(HAVE_PTHREAD, test "$have_pthread" = "yes")
AC_SUBST(PTHREAD_LIBS)

dnl Checks for header files.
AC_HEADER_STDC
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)

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T
AC_TYPE_MODE_T
AC_CHECK_TYPE(intptr_t)
AC_STRUCT_TM

dnl Checks for library functions.
AC_CHECK_FUNCS(gmtime_r isspace iswspace strdup snprintf unsetenv setenv)

dnl **************************************************
dnl * Check for C++
dnl **************************************************

AC_ARG_ENABLE(cxx, 
[  --enable-cxx           Enable C++ bindings],,enable_cxx="no")
AM_CONDITIONAL(WITH_CXX_BINDINGS, test x$enable_cxx = "xyes")

AC_PREFIX_DEFAULT(/usr/local/libical)
if test "$prefix" = NONE; then
	AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "$ac_default_prefix/share/libical", [where our self provided zonefiles should live])
	ssl_dir="$ac_default_prefix/keys"
else
	AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "$prefix/share/libical", [where our self provided zonefiles should live])
fi

dnl **************************************************
dnl * Check for Java
dnl **************************************************

AC_ARG_ENABLE(java, 
[  --enable-java          Enable Java bindings],,enable_java="no")
if test "x$enable_java" = "xyes"; then
  AC_PATH_PROG(JAR, jar, /usr/local/bin/jar, /usr/local/bin:$PATH)
  AC_PATH_PROG(JAVA, java, /usr/local/bin/java, /usr/local/bin:$PATH)
  AC_PATH_PROG(JAVAC, javac, /usr/local/bin/javac, /usr/local/bin:$PATH)
  AC_PATH_PROG(JAVAH, javah, /usr/local/bin/javah, /usr/local/bin:$PATH)
  AC_SUBST(JAR)
  AC_SUBST(JAVA)
  AC_SUBST(JAVAC)
  AC_SUBST(JAVAH)

  dnl truly gross

  case "${host}" in
        *-*-solaris*)   JAVA_PLATFORM="solaris" ;;
        *-*-linux*)     JAVA_PLATFORM="linux" ;;
        *-*-freebsd*)   JAVA_PLATFORM="bsd" ;;
        *-*-aix*)       JAVA_PLATFORM="aix" ;;
        *-sequent-*)    JAVA_PLATFORM="ptx" ;;
        *-*-hpux*)      JAVA_PLATFORM="hpux" ;;
        *-*-irix*)      JAVA_PLATFORM="irix" ;;
        *-*-os390*)     JAVA_PLATFORM="os390" ;;
        *-*-os400*)     JAVA_PLATFORM="os400" ;;
        *-apple-darwin*|*-apple-rhapsody*)      JAVA_PLATFORM="darwin" ;;
        *)              JAVA_PLATFORM="unknown" ;;
  esac

  AC_SUBST(JAVA_PLATFORM)
fi
enable_java=no
AM_CONDITIONAL(WITH_JAVA, test x$enable_java = "xyes")

dnl **************************************************
dnl * Check for Python
dnl **************************************************
python_val=false
AC_ARG_ENABLE(python, 
[  --enable-python         Enable python bindings],,enable_python="no")

if test "x$enable_python" = "xyes"; then
  AM_PATH_PYTHON([2.3], , [:])
  AM_CONDITIONAL([HAVE_PYTHON], [test "$PYTHON" != :])
  AC_CHECK_PROG(swig_val, swig, true, false)
  AM_CONDITIONAL([HAVE_SWIG], [test "x$swig_val" = "xtrue"])
  
  PY_PREFIX=`$PYTHON -c 'import sys ; print sys.prefix'`
  AC_CHECK_HEADER([python$PYTHON_VERSION/Python.h],[],[AC_MSG_ERROR([Can't find python header files])])
  if test -f "$PY_PREFIX/include/python$PYTHON_VERSION/Python.h"; then
    
    PY_CFLAGS="-I$PY_PREFIX/include/python$PYTHON_VERSION"
    AC_SUBST(PY_CFLAGS)
    
    # SWIG needs PIC in order to work.
    CFLAGS="$CFLAGS -fPIC"
  fi
  
  AC_CONFIG_FILES([src/python/Makefile])
else
  AM_CONDITIONAL([HAVE_PYTHON], false)
  AM_CONDITIONAL([HAVE_SWIG], false)
fi

if test "$use_builtin_timezone" = "yes"; then
  AC_CONFIG_FILES([zoneinfo/Makefile])
fi

AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([design-data/Makefile])
AC_CONFIG_FILES([doc/Makefile])
AC_CONFIG_FILES([examples/Makefile])
AC_CONFIG_FILES([scripts/Makefile])
AC_CONFIG_FILES([src/Makefile])
AC_CONFIG_FILES([src/libical/Makefile])
AC_CONFIG_FILES([src/libical/icalversion.h])
AC_CONFIG_FILES([src/libical/icalerror.h])
AC_CONFIG_FILES([src/libicalss/Makefile])
AC_CONFIG_FILES([src/libicalvcal/Makefile])
AC_CONFIG_FILES([src/test/Makefile])
AC_CONFIG_FILES([test-data/Makefile])
AC_CONFIG_FILES([libical.pc])

AC_OUTPUT