summaryrefslogtreecommitdiffstats
path: root/configure.ac
blob: 3f7b492cb0364266a4caf8196b4ee41a9206481e (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
#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ(2.61)

AC_INIT([libcaldav], m4_esyscmd([sh ./version.sh | tr -d '\n']), [mir@datanom.net])
AC_CONFIG_MACRO_DIR([m4])

LIBVERSION=m4_esyscmd([sh ./version.sh LIBTOOL | tr -d '\n'])
AC_SUBST(LIBVERSION)

AC_CANONICAL_SYSTEM

# Generate documentation
# API
DX_HTML_FEATURE(OFF)
DX_CHM_FEATURE(OFF)
DX_CHI_FEATURE(OFF)
DX_MAN_FEATURE(ON)
DX_RTF_FEATURE(OFF)
DX_XML_FEATURE(OFF)
DX_PDF_FEATURE(ON)
DX_PS_FEATURE(OFF)
DX_INIT_DOXYGEN(libcaldav, doxygen-api.cfg, doc)

AM_INIT_AUTOMAKE([dist-bzip2 1.9.6])
AM_MAINTAINER_MODE
AC_CONFIG_HEADER([config.h])
AM_MAINTAINER_MODE

if test $USE_MAINTAINER_MODE = yes; then
	CFLAGS="-g -Wall -D_REENTRANT"
	STATIC=1
	DYNAMIC=0
	BUILD_TEST=true
else
	#CFLAGS="-g -Wall"
	CFLAGS="$CFLAGS -O2 -Wall -D_REENTRANT"
	STATIC=0
	DYNAMIC=1
	BUILD_TEST=false
fi
AM_CONDITIONAL([STATIC_LINK], [test $STATIC -eq 1])
AM_CONDITIONAL([DYNAMIC_LINK], [test $DYNAMIC -eq 1])

# Checks for programs.
AC_PROG_CC
AC_LANG_C
AC_ISC_POSIX
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_HEADER_STDC
AC_PROG_CPP
AM_PROG_LIBTOOL
AC_PROG_INSTALL

# Checks for libraries.
PKG_CHECK_MODULES(CURL, [libcurl >= 7.15.5])
AC_SUBST(CURL_CFLAGS)
AC_SUBST(CURL_LIBS)

PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.6 gthread-2.0])
AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS)

#PKG_CHECK_MODULES(OPENSSL, [openssl >= 0.9.8])
#AC_SUBST(OPENSSL_CFLAGS)
#AC_SUBST(OPENSSL_LIBS)

# Checks for header files.
AC_HEADER_STDC

# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T
AC_STRUCT_TM

# Checks for library functions.

# Should we build test program
AC_ARG_ENABLE([caldav], 
		[AC_HELP_STRING(--enable-caldav, Build test application (default=no))],
		[case "${enableval}" in
			yes) caldav=true ;;
			no) caldav=false ;;
			*) AC_MSG_ERROR([bad value "${enableval}" for --enable-caldav]) ;;
			esac], [caldav=$BUILD_TEST])
AM_CONDITIONAL([BUILD_CALDAV], [test x$caldav = xtrue])

# Should we build unit test program
AC_ARG_ENABLE([unittest], 
		[AC_HELP_STRING(--enable-unittest, Build unti test application (default=no))],
		[case "${enableval}" in
			yes) unittest=true ;;
			no) unittest=false ;;
			*) AC_MSG_ERROR([bad value "${enableval}" for --enable-unittest]) ;;
			esac], [unittest=$BUILD_TEST])
AM_CONDITIONAL([BUILD_UNITTEST], [test x$unittest = xtrue])

# Build API documentation
AC_ARG_ENABLE([doc], 
		[AC_HELP_STRING(--enable-doc, Build API documentation (default=no))],
		[case "${enableval}" in
			yes) doc=true ;;
			no) doc=false ;;
			*) AC_MSG_ERROR([bad value "${enableval}" for --enable-doc]) ;;
			esac], [doc=false])
AM_CONDITIONAL([BUILD_DOC], [test x$doc = xtrue])

AC_CONFIG_COMMANDS(
    summary,
    [echo ""
    echo "libcaldav will be compiled with these settings:"
    echo ""
    echo -e "\tCFLAGS:\t\t\t\t$cflags"
    echo -e "\tBuild caldav-test:\t\t$caldav"
    echo -e "\tBuild unittest:\t\t\t$unittest"
    echo -e "\tBuild API documentation:\t$doc"
	echo -e "\tLibrary is linked:\t\t$link"
	echo ""
	echo -e "Now run make to build the library"
	echo ""
	echo -e "Please send bugs or feature requests to the maintainer(s)."
	echo -e "Email addresses can be found in the AUTHORS file."
    echo ""],
    [caldav=${caldav}
     unittest=${unittest}
     doc=${doc}
     cflags="${CFLAGS}"
	 if test $DYNAMIC -eq 1; then
		link="Dynamic"
	else
		link="Static"
	fi]
)

AC_OUTPUT([
	Makefile
	libcaldav.pc
	src/Makefile
	test/Makefile
	test/src/Makefile
	test/ics/Makefile
	test/unittest/Makefile
])