]> git.meshlink.io Git - catta/blob - configure.ac
7aa4fa4255de9159a6eea5e8bbb5bf1f35ea1a18
[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-glib-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         AC_SUBST(DBUS_CFLAGS)
164         AC_SUBST(DBUS_LIBS)
165 fi
166
167 AM_CONDITIONAL(ENABLE_DBUS, test "x$ENABLE_DBUS" = "xyes")
168
169 #
170 # Expat
171 #
172 AC_CHECK_LIB(expat, XML_ParserCreate, [ AC_CHECK_HEADERS(expat.h, have_expat=true, have_expat=false) ], have_expat=false)
173
174 if ! $have_expat ; then
175    AC_MSG_ERROR([*** libexpat not found ***])
176 fi
177
178 #
179 # LibDaemon
180 #
181 PKG_CHECK_MODULES(LIBDAEMON, [ libdaemon >= 0.5 ])
182 AC_SUBST(LIBDAEMON_CFLAGS)
183 AC_SUBST(LIBDAEMON_LIBS)
184
185 # If using GCC specify some additional parameters
186 if test "x$GCC" = "xyes" ; then
187    CFLAGS="$CFLAGS -pipe -W -Wall -pedantic"
188
189    AC_LANG_CONFTEST([int main() {}])
190    $CC -c conftest.c -std=c99 -Wno-unused-parameter $CFLAGS > /dev/null 2> /dev/null && CFLAGS="$CFLAGS -std=c99 -Wno-unused-parameter"
191    rm -f conftest.o
192 fi
193
194 #
195 # Detecting the linux distro for specific things like initscripts.
196 #
197 AC_ARG_WITH(distro, AS_HELP_STRING([--with-distro=DISTRO],[Specify the Linux distribution to target: One of redhat, suse, gentoo, debian, or slackware]))
198 if test "z$with_distro" = "z"; then
199    AC_CHECK_FILE(/etc/redhat-release,with_distro="redhat")
200    AC_CHECK_FILE(/etc/SuSE-release,with_distro="suse")
201    AC_CHECK_FILE(/etc/fedora-release,with_distro="redhat")
202    AC_CHECK_FILE(/etc/gentoo-release,with_distro="gentoo")
203    AC_CHECK_FILE(/etc/debian_version,with_distro="debian")
204    AC_CHECK_FILE(/etc/slackware-version,with_distro="slackware")
205 fi
206 with_distro=`echo ${with_distro} | tr '[[:upper:]]' '[[:lower:]]' `
207
208 if test "z$with_distro" = "z"; then
209    echo "Linux distribution autodetection failed, you must specify the distribution to target using --with-distro=DISTRO"
210    exit 1
211 else
212 case $with_distro in
213    debian|gentoo|suse)
214      ;;
215    *)
216      echo "Your distribution (${with_distro}) is not yet supported, init scripts and dbus configuration will not be installed! (patches welcome)"
217      ;;
218 esac
219
220 fi
221 AM_CONDITIONAL(TARGET_REDHAT, test x"$with_distro" = xredhat)
222 AM_CONDITIONAL(TARGET_SUSE, test x"$with_distro" = xsuse)
223 AM_CONDITIONAL(TARGET_GENTOO, test x"$with_distro" = xgentoo)
224 AM_CONDITIONAL(TARGET_DEBIAN, test x"$with_distro" = xdebian)
225 AM_CONDITIONAL(TARGET_SLACKWARE, test x"$with_distro" = xslackware)
226
227 #
228 # Defining Avahi User and Group.
229 #
230 AC_ARG_WITH(avahi_user, AS_HELP_STRING([--with-avahi-user=<user>],[User for running the Avahi daemon (avahi)]))
231 if test -z "$with_avahi_user" ; then
232     AVAHI_USER=avahi
233 else
234     AVAHI_USER=$with_avahi_user
235 fi
236 AC_SUBST(AVAHI_USER)
237 AC_DEFINE_UNQUOTED(AVAHI_USER,"$AVAHI_USER", [User for running the Avahi daemon])
238
239 AC_ARG_WITH(avahi_group,AS_HELP_STRING([--with-avahi-group=<group>],[Group for Avahi (avahi)]))
240 if test -z "$with_avahi_group" ; then
241     AVAHI_GROUP=avahi
242 else
243     AVAHI_GROUP=$with_avahi_group
244 fi
245 AC_SUBST(AVAHI_GROUP)
246 AC_DEFINE_UNQUOTED(AVAHI_GROUP,"$AVAHI_GROUP", [Group for Avahi])
247
248 #
249 # Avahi runtime dir
250 #
251 avahi_runtime_dir="${localstatedir}/run"
252 avahi_socket="${avahi_runtime_dir}/avahi-daemon/socket"
253 AC_SUBST(avahi_runtime_dir)
254 AC_SUBST(avahi_socket)
255
256 #
257 # Python stuff
258 #
259 AC_ARG_ENABLE(python,
260         AS_HELP_STRING([--disable-python], [Disable scripts that depends on python]),
261         [case "${enableval}" in
262               yes) use_python=yes ;;
263               no)  use_python=no ;;
264               *) AC_MSG_ERROR([bad value ${enableval} for --disable-python]) ;;
265         esac],[use_python=yes])
266
267 HAVE_PYTHON=no
268 if test "x$use_python" = xyes ; then
269    AM_PATH_PYTHON(2.4, [HAVE_PYTHON=yes], [HAVE_PYTHON=no])
270
271    if  test "x$HAVE_PYTHON" = xyes ; then
272        AM_CHECK_PYMOD(gtk,,,[AC_MSG_ERROR(could not find pygtk module)])
273        AM_CHECK_PYMOD(dbus,,,[AC_MSG_ERROR(could not find python dbus module)])
274    fi
275 fi
276
277 AM_CONDITIONAL(HAVE_PYTHON, [test "x$HAVE_PYTHON" = xyes ])
278
279 # ==========================================================================
280 AC_CONFIG_FILES([
281 Makefile 
282 avahi-core.pc 
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 "