]> git.meshlink.io Git - catta/blob - configure.ac
693a7bc7b0637c870437da92445d70f244bc3eb9
[catta] / configure.ac
1 # -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
3
4 # $Id$
5
6 # This file is part of avahi.
7 #
8 # avahi is free software; you can redistribute it and/or modify it
9 # under the terms of the GNU Lesser General Public License as
10 # published by the Free Software Foundation; either version 2 of the
11 # License, or (at your option) any later version.
12 #
13 # avahi is distributed in the hope that it will be useful, but WITHOUT
14 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
16 # License for more details.
17 #
18 # You should have received a copy of the GNU Lesser General Public
19 # License along with avahi; if not, write to the Free Software
20 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
21 # USA.
22
23 AC_PREREQ(2.57)
24 AC_INIT([avahi],[0.1],[avahi (at) lists (dot) freedesktop (dot) org])
25 AC_CONFIG_SRCDIR([avahi-core/server.c])
26 AC_CONFIG_HEADERS([config.h])
27 AM_INIT_AUTOMAKE([foreign 1.9 -Wall])
28
29 AC_SUBST(PACKAGE_URL, [http://www.freedesktop.org/Software/Avahi])
30
31 if type -p stow > /dev/null && test -d /usr/local/stow ; then
32    AC_MSG_NOTICE([*** Found /usr/local/stow: default install prefix set to /usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION} ***])
33    ac_default_prefix="/usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION}"
34 fi
35
36 # Checks for programs.
37 AC_PROG_CC
38 AC_PROG_CXX
39 AC_GNU_SOURCE
40 AC_PROG_CPP
41 AC_PROG_INSTALL
42 AC_PROG_LN_S
43 AC_PROG_MAKE_SET
44 AC_PROG_GCC_TRADITIONAL
45
46 # libtool stuff
47 AC_PROG_LIBTOOL
48
49 # Checks for header files.
50 AC_HEADER_STDC
51 AC_CHECK_HEADERS([arpa/inet.h fcntl.h inttypes.h limits.h netinet/in.h stdlib.h string.h sys/ioctl.h sys/socket.h sys/time.h unistd.h])
52
53 # Checks for typedefs, structures, and compiler characteristics.
54 AC_C_CONST
55 AC_TYPE_SIZE_T
56 AC_HEADER_TIME
57 AC_HEADER_SYS_WAIT
58
59 # Checks for library functions.
60 AC_FUNC_MEMCMP
61 AC_FUNC_SELECT_ARGTYPES
62 AC_FUNC_MALLOC
63 AC_FUNC_REALLOC
64 AC_CHECK_FUNCS([gethostname memchr memmove memset mkdir select socket strchr strcspn strdup strerror strrchr strspn strstr uname setresuid setreuid strcasecmp gettimeofday])
65
66 AC_FUNC_CHOWN
67 AC_FUNC_STAT
68 AC_TYPE_MODE_T
69 AC_TYPE_PID_T
70
71 # Check for GLIB 2.0
72 PKG_CHECK_MODULES(GLIB20, [ glib-2.0 >= 2.4.0 ])
73 AC_SUBST(GLIB20_CFLAGS)
74 AC_SUBST(GLIB20_LIBS)
75
76 AC_ARG_ENABLE(gtk,
77         AS_HELP_STRING([--disable-gtk],[Use GTK+ (default=yes)]),
78         [case "${enableval}" in
79                 yes) ENABLE_GTK=yes ;;
80                 no)  ENABLE_GTK=no ;;
81                 *) AC_MSG_ERROR(bad value ${enableval} for --enable-gtk) ;;
82         esac],
83         [ENABLE_GTK=yes]) dnl Default value
84
85 if test "x$ENABLE_GTK" = "xyes"; then
86         # Check for GTK 2.0
87         PKG_CHECK_MODULES(GTK20, [ gtk+-2.0 >= 2.4.0 ])
88         AC_SUBST(GTK20_CFLAGS)
89         AC_SUBST(GTK20_LIBS)
90         
91         # Check for GLADE 2.0
92         PKG_CHECK_MODULES(GLADE20, [ libglade-2.0 >= 2.4.0 ])
93         AC_SUBST(GLADE20_CFLAGS)
94         AC_SUBST(GLADE20_LIBS)
95
96         interfacesdir="${datadir}/${PACKAGE}/interfaces/"
97         AC_SUBST(interfacesdir)
98
99 fi
100 AM_CONDITIONAL(ENABLE_GTK, test "x$ENABLE_GTK" = "xyes")
101
102 #
103 # Doxygen
104 #
105 DX_HTML_FEATURE(ON)
106 DX_CHM_FEATURE(OFF)
107 DX_CHI_FEATURE(OFF)
108 DX_MAN_FEATURE(OFF)
109 DX_RTF_FEATURE(OFF)
110 DX_XML_FEATURE(OFF)
111 DX_PDF_FEATURE(OFF)
112 DX_PS_FEATURE(OFF)
113 DX_INIT_DOXYGEN(avahi, doxygen.cfg, doxygen)
114
115 #
116 # XMLTOMAN manpage generation
117 #
118 AC_ARG_ENABLE(xmltoman,
119         AS_HELP_STRING([--disable-xmltoman],[Disable rebuilding of man pages with xmltoman]),
120 [case "${enableval}" in
121   yes) xmltoman=yes ;;
122   no)  xmltoman=no ;;
123   *) AC_MSG_ERROR([bad value ${enableval} for --disable-xmltoman]) ;;
124 esac],[xmltoman=yes])
125
126 if test x$xmltoman = xyes ; then
127    AC_CHECK_PROG(have_xmltoman, xmltoman, yes, no)
128
129    if test x$have_xmltoman = xno ; then
130      AC_MSG_WARN([*** Not rebuilding man pages as xmltoman is not found ***])
131      xmltoman=no
132    fi
133 fi
134
135 AM_CONDITIONAL([USE_XMLTOMAN], [test "x$xmltoman" = xyes])
136
137 #
138 # D-BUS
139 #
140 AC_ARG_ENABLE(dbus,
141         AS_HELP_STRING([--disable-dbus],[Enable DBUS support (default=no)]),
142         [case "${enableval}" in
143                 yes) ENABLE_DBUS=yes ;;
144                 no)  ENABLE_DBUS=no ;;
145                 *) AC_MSG_ERROR(bad value ${enableval} for --enable-dbus) ;;
146         esac],
147         [ENABLE_DBUS=yes]) dnl Default value
148
149
150 if test "x$ENABLE_DBUS" = "xyes"; then
151         AC_DEFINE(ENABLE_DBUS, 1, [Whether to use DBUS or not])
152         PKG_CHECK_MODULES(DBUS, [ dbus-1 >= 0.30])
153
154         AC_ARG_WITH(dbus-sys, AS_HELP_STRING([--with-dbus-sys=<dir>], [where D-BUS system.d directory is]))
155
156         if ! test -z "$with_dbus_sys" ; then
157            DBUS_SYS_DIR="$with_dbus_sys"
158         else
159            DBUS_SYS_DIR="${sysconfdir}/dbus-1/system.d"
160         fi
161         AC_SUBST(DBUS_SYS_DIR)
162     
163     DBUS_CFLAGS="$DBUS_CFLAGS -DDBUS_API_SUBJECT_TO_CHANGE"
164     AC_SUBST(DBUS_CFLAGS)
165         AC_SUBST(DBUS_LIBS)
166 fi
167
168 AM_CONDITIONAL(ENABLE_DBUS, test "x$ENABLE_DBUS" = "xyes")
169
170 #
171 # Expat
172 #
173 AC_CHECK_LIB(expat, XML_ParserCreate, [ AC_CHECK_HEADERS(expat.h, have_expat=true, have_expat=false) ], have_expat=false)
174
175 if ! $have_expat ; then
176    AC_MSG_ERROR([*** libexpat not found ***])
177 fi
178
179 #
180 # LibDaemon
181 #
182 PKG_CHECK_MODULES(LIBDAEMON, [ libdaemon >= 0.5 ])
183 AC_SUBST(LIBDAEMON_CFLAGS)
184 AC_SUBST(LIBDAEMON_LIBS)
185
186 # If using GCC specify some additional parameters
187 if test "x$GCC" = "xyes" ; then
188    CFLAGS="$CFLAGS -pipe -W -Wall -pedantic"
189
190    AC_LANG_CONFTEST([int main() {}])
191    $CC -c conftest.c -std=c99 -Wno-unused-parameter $CFLAGS > /dev/null 2> /dev/null && CFLAGS="$CFLAGS -std=c99 -Wno-unused-parameter"
192    rm -f conftest.o
193 fi
194
195 #
196 # Detecting the linux distro for specific things like initscripts.
197 #
198 AC_ARG_WITH(distro, AS_HELP_STRING([--with-distro=DISTRO],[Specify the Linux distribution to target: One of redhat, suse, gentoo, debian, or slackware]))
199 if test "z$with_distro" = "z"; then
200    AC_CHECK_FILE(/etc/redhat-release,with_distro="redhat")
201    AC_CHECK_FILE(/etc/SuSE-release,with_distro="suse")
202    AC_CHECK_FILE(/etc/fedora-release,with_distro="redhat")
203    AC_CHECK_FILE(/etc/gentoo-release,with_distro="gentoo")
204    AC_CHECK_FILE(/etc/debian_version,with_distro="debian")
205    AC_CHECK_FILE(/etc/slackware-version,with_distro="slackware")
206 fi
207 with_distro=`echo ${with_distro} | tr '[[:upper:]]' '[[:lower:]]' `
208
209 if test "z$with_distro" = "z"; then
210    echo "Linux distribution autodetection failed, you must specify the distribution to target using --with-distro=DISTRO"
211    exit 1
212 else
213 case $with_distro in
214    debian|gentoo|suse)
215      ;;
216    *)
217      echo "Your distribution (${with_distro}) is not yet supported, init scripts and dbus configuration will not be installed! (patches welcome)"
218      ;;
219 esac
220
221 fi
222 AM_CONDITIONAL(TARGET_REDHAT, test x"$with_distro" = xredhat)
223 AM_CONDITIONAL(TARGET_SUSE, test x"$with_distro" = xsuse)
224 AM_CONDITIONAL(TARGET_GENTOO, test x"$with_distro" = xgentoo)
225 AM_CONDITIONAL(TARGET_DEBIAN, test x"$with_distro" = xdebian)
226 AM_CONDITIONAL(TARGET_SLACKWARE, test x"$with_distro" = xslackware)
227
228 #
229 # Defining Avahi User and Group.
230 #
231 AC_ARG_WITH(avahi_user, AS_HELP_STRING([--with-avahi-user=<user>],[User for running the Avahi daemon (avahi)]))
232 if test -z "$with_avahi_user" ; then
233     AVAHI_USER=avahi
234 else
235     AVAHI_USER=$with_avahi_user
236 fi
237 AC_SUBST(AVAHI_USER)
238 AC_DEFINE_UNQUOTED(AVAHI_USER,"$AVAHI_USER", [User for running the Avahi daemon])
239
240 AC_ARG_WITH(avahi_group,AS_HELP_STRING([--with-avahi-group=<group>],[Group for Avahi (avahi)]))
241 if test -z "$with_avahi_group" ; then
242     AVAHI_GROUP=avahi
243 else
244     AVAHI_GROUP=$with_avahi_group
245 fi
246 AC_SUBST(AVAHI_GROUP)
247 AC_DEFINE_UNQUOTED(AVAHI_GROUP,"$AVAHI_GROUP", [Group for Avahi])
248
249 #
250 # Avahi runtime dir
251 #
252 avahi_runtime_dir="${localstatedir}/run"
253 avahi_socket="${avahi_runtime_dir}/avahi-daemon/socket"
254 AC_SUBST(avahi_runtime_dir)
255 AC_SUBST(avahi_socket)
256
257 #
258 # Python stuff
259 #
260 AC_ARG_ENABLE(python,
261         AS_HELP_STRING([--disable-python], [Disable scripts that depends on python]),
262         [case "${enableval}" in
263               yes) use_python=yes ;;
264               no)  use_python=no ;;
265               *) AC_MSG_ERROR([bad value ${enableval} for --disable-python]) ;;
266         esac],[use_python=yes])
267
268 HAVE_PYTHON=no
269 if test "x$use_python" = xyes ; then
270    AM_PATH_PYTHON(2.4, [HAVE_PYTHON=yes], [HAVE_PYTHON=no])
271
272    if  test "x$HAVE_PYTHON" = xyes ; then
273        AM_CHECK_PYMOD(gtk,,,[AC_MSG_ERROR(could not find pygtk module)])
274        AM_CHECK_PYMOD(dbus,,,[AC_MSG_ERROR(could not find python dbus module)])
275    fi
276 fi
277
278 AM_CONDITIONAL(HAVE_PYTHON, [test "x$HAVE_PYTHON" = xyes ])
279
280 # ==========================================================================
281 AC_CONFIG_FILES([
282 Makefile 
283 avahi-common/Makefile 
284 avahi-core/Makefile 
285 avahi-glib/Makefile 
286 avahi-daemon/Makefile 
287 avahi-daemon/avahi-dbus.conf
288 avahi-discover-standalone/Makefile 
289 avahi-client/Makefile 
290 initscript/Makefile 
291 initscript/Debian/Makefile
292 initscript/Gentoo/Makefile
293 initscript/SUSE/Makefile
294 avahi-dnsconfd/Makefile
295 avahi-utils/Makefile
296 avahi-utils/avahi/Makefile
297 examples/Makefile
298 common/Makefile
299 man/Makefile
300 tests/Makefile
301 ])
302 AC_OUTPUT
303
304 # ==========================================================================
305 echo "
306  ---{ $PACKAGE_NAME $VERSION }---
307
308     prefix:                 ${prefix}
309     sysconfdir:             ${sysconfdir}
310     dbus-1 system.d dir:    ${DBUS_SYS_DIR}
311     dbus-1 version:         `pkg-config dbus-1 --modversion`
312     compiler:               ${CC}
313     cflags:                 ${CFLAGS}
314     Enable Gtk:             ${ENABLE_GTK}
315     Enable DBUS:            ${ENABLE_DBUS}
316     Have Python:            ${HAVE_PYTHON}
317     Linux Distro:           ${with_distro}
318     User for Avahi:         ${AVAHI_USER}
319     Group for Avahi:        ${AVAHI_GROUP}
320
321  NOTE: Remember to create user ${AVAHI_USER} and group ${AVAHI_GROUP} before make install
322 "