]> arthur.barton.de Git - netatalk.git/blob - configure.ac
update initscripts
[netatalk.git] / configure.ac
1 dnl configure.ac for netatalk
2
3 AC_INIT(etc/afpd/main.c)
4
5 NETATALK_VERSION=`cat $srcdir/VERSION`
6 AC_SUBST(NETATALK_VERSION)
7
8 AC_CANONICAL_SYSTEM
9 AM_INIT_AUTOMAKE(netatalk, ${NETATALK_VERSION})
10 AM_CONFIG_HEADER(config.h)
11 AM_MAINTAINER_MODE([enable])
12
13 dnl Checks for programs.
14 AC_PROG_AWK
15 AC_PROG_CC
16 AC_PROG_CC_C99
17 AC_PROG_INSTALL
18 AC_PROG_LN_S
19 AC_PROG_MAKE_SET
20 AC_LIBTOOL_DLOPEN
21 AC_PROG_LIBTOOL
22 AC_PROG_PERL
23 AC_PROG_GREP
24 AC_PROG_PS
25 AM_PROG_CC_C_O
26
27 dnl Checks for typedefs, structures, and compiler characteristics.
28 AC_C_INLINE
29
30 dnl Request SUSv3 standard interfaces plus anything else the platform may have
31 CFLAGS="$CFLAGS -D_XOPEN_SOURCE=600 -D__EXTENSIONS__ -D_GNU_SOURCE"
32
33 dnl Check if we can use attribute unused (gcc only) from ethereal
34 AC_MSG_CHECKING(to see if we can add '__attribute__((unused))' to CFLAGS)
35 if test x$GCC != x ; then
36   CFLAGS="-D_U_=\"__attribute__((unused))\" $CFLAGS"
37   AC_MSG_RESULT(yes)
38 else
39   CFLAGS="-D_U_=\"\" $CFLAGS"
40   AC_MSG_RESULT(no)
41 fi
42
43 dnl Checks for header files, some checks are obsolete, unfortunately the code
44 dnl uses the resulting macros, so the code has to cleaned up too before
45 dnl we can remove the checks here.
46 AC_CHECK_HEADERS(mntent.h unistd.h termios.h ufs/quota.h)
47 AC_CHECK_HEADERS(netdb.h sgtty.h statfs.h dlfcn.h langinfo.h locale.h)
48 AC_CHECK_HEADERS(sys/param.h sys/fcntl.h sys/termios.h)
49 AC_CHECK_HEADERS(sys/mnttab.h sys/statvfs.h sys/stat.h sys/vfs.h)
50 dnl Checks for header files, confirmed to be required as of 2011
51 AC_CHECK_HEADERS(sys/epoll.h)
52 AC_CHECK_HEADERS([sys/mount.h], , , 
53 [#ifdef HAVE_SYS_PARAM_H
54 #include <sys/param.h>
55 #endif
56 ])
57
58 AC_SYS_LARGEFILE([], AC_MSG_ERROR([AFP 3.x support requires Large File Support.]))
59
60 dnl --------------------------------------------------------------------------
61 dnl check if dlsym needs to add an underscore, uses libtool macros 
62 dnl --------------------------------------------------------------------------
63 AC_LTDL_DLLIB
64 AC_CHECK_FUNCS(dlopen dlsym dlclose)
65 AC_LTDL_DLSYM_USCORE
66 if test x"$libltdl_cv_need_uscore" = xyes; then
67     AC_DEFINE(DLSYM_PREPEND_UNDERSCORE, 1, [BSD compatibility macro])
68 fi
69
70 dnl Special hecks
71 ac_neta_haveatfuncs=yes
72 AC_CHECK_FUNCS(openat renameat fstatat unlinkat, , ac_neta_haveatfuncs=no)
73 if test x"$ac_neta_haveatfuncs" = x"yes" ; then
74    AC_DEFINE([_ATFILE_SOURCE], 1, AT file source)
75    AC_DEFINE([HAVE_ATFUNCS], 1, whether at funcs are available)
76 fi
77 AC_CHECK_MEMBERS(struct tm.tm_gmtoff,,, [#include <time.h>])
78
79 dnl these tests have been comfirmed to be needed in 2011
80 AC_CHECK_FUNC(epoll_create, AC_DEFINE([HAVE_EPOLL], 1, Whether Linux epoll is available)) 
81 AC_CHECK_FUNCS(backtrace_symbols dirfd getusershell pread pwrite pselect)
82 AC_CHECK_FUNCS(setlinebuf strlcat strlcpy strnlen)
83 AC_CHECK_FUNCS(mmap utime getpagesize) dnl needed by tbd
84
85 dnl search for necessary libraries
86 AC_SEARCH_LIBS(gethostbyname, nsl)
87 AC_SEARCH_LIBS(connect, socket)
88 AC_SEARCH_LIBS(pthread_sigmask, pthread,,[AC_MSG_ERROR([missing pthread_sigmask])])
89 if test x"$ac_cv_search_pthread_sigmask" != x"none required" ; then
90    PTHREAD_LIBS=$ac_cv_search_pthread_sigmask
91 fi
92 AC_SUBST(PTHREAD_LIBS)
93
94 AC_DEFINE(OPEN_NOFOLLOW_ERRNO, ELOOP, errno returned by open with O_NOFOLLOW)
95
96 AC_CACHE_SAVE
97
98 dnl --------------------------------------------------------------------------
99 dnl 64bit platform check
100 dnl --------------------------------------------------------------------------
101
102 AC_MSG_CHECKING([whether to check for 64bit libraries])
103 # Test if the compiler is in 64bit mode
104 echo 'int i;' > conftest.$ac_ext
105 atalk_cv_cc_64bit_output=no
106 if AC_TRY_EVAL(ac_compile); then
107     case `/usr/bin/file conftest.$ac_objext` in
108     *"ELF 64"*)
109       atalk_cv_cc_64bit_output=yes
110       ;;
111     esac
112 fi
113 rm -rf conftest*
114
115 case $host_cpu:$atalk_cv_cc_64bit_output in
116 powerpc64:yes | s390x:yes | sparc*:yes | x86_64:yes | i386:yes)
117     case $target_os in
118     solaris2*)
119         AC_MSG_RESULT([yes])
120         atalk_libname="lib/64"
121         ;;
122     *bsd* | dragonfly*)
123         AC_MSG_RESULT([no])
124         atalk_libname="lib"
125         ;;
126     *)
127         AC_MSG_RESULT([yes])
128         atalk_libname="lib64"
129         ;;
130     esac
131     ;;
132 *:*)
133     AC_MSG_RESULT([no])
134     atalk_libname="lib"
135     ;;
136 esac
137
138 dnl --------------------------------------------------------------------------
139 dnl OS specific configuration comes in here:
140 dnl --------------------------------------------------------------------------
141
142 AC_NETATALK_OS_SPECIFIC
143
144 dnl --------------------------------------------------------------------------
145 dnl specific configuration comes in here:
146 dnl --------------------------------------------------------------------------
147
148 dnl Check for optional admin group support
149 AC_NETATALK_ADMIN_GROUP
150
151 dnl Check for optional AFS support
152 AC_NETATALK_AFS_CHECK
153
154 dnl --with-pkgconfdir check to change configuration directory location
155 AC_NETATALK_CONFIG_DIRS
156
157 dnl Check for optional cracklib support
158 AC_NETATALK_CRACKLIB
159
160 dnl Check whether to enable debug code
161 AC_NETATALK_DEBUG
162
163 dnl Check whethe to disable tickle SIGALARM stuff, which eases debugging
164 AC_NETATALK_DEBUGGING
165
166 dnl     Check for libiconv support
167 AC_NETATALK_CHECK_ICONV
168
169 dnl Check for CNID database backends
170 AC_NETATALK_CNID([bdb_required=yes],[bdb_required=no])
171
172 dnl Check for quota support
173 AC_NETATALK_CHECK_QUOTA
174
175 dnl Check for optional Zeroconf support
176 AC_NETATALK_ZEROCONF
177
178 dnl Check for optional TCP-wrappers support
179 AC_NETATALK_TCP_WRAPPERS
180
181 dnl Check for PAM libs
182 AC_NETATALK_PATH_PAM
183
184 dnl Check for optional shadow password support
185 AC_NETATALK_SHADOW
186         
187 dnl Check for optional valid-shell-check support
188 AC_NETATALK_SHELL_CHECK
189
190 dnl Check for optional Webmin
191 AC_NETATALK_WEBMIN
192
193 dnl Check for optional sysv initscript install
194 AC_NETATALK_SYSV_STYLE
195
196 dnl Path where UAM modules shall be installed
197 AC_ARG_WITH(uams-path, [  --with-uams-path=PATH   path to UAMs [[PKGCONF/uams]]], [uams_path="$withval"], [uams_path="${PKGCONFDIR}/uams"])
198
199 dnl Check for libgcrypt, if found enables DHX2 UAM
200 AC_NETATALK_PATH_LIBGCRYPT([1:1.2.3])
201
202 dnl Check for openssl, if found enables DHX UAM and Randnum UAM
203 AC_NETATALK_PATH_SSL
204
205 dnl Check for Berkeley DB library
206 AC_NETATALK_PATH_BDB
207
208 dnl Check for crypt
209 AC_NETATALK_CRYPT
210
211 dnl Check for building PGP UAM module
212 AC_NETATALK_PGP_UAM
213
214 dnl Check for building Kerberos V UAM module
215 AC_NETATALK_KRB5_UAM
216
217 dnl Check for overwrite the config files or not
218 AC_NETATALK_OVERWRITE_CONFIG
219
220 dnl Check for LDAP support, for client-side ACL visibility
221 AC_NETATALK_LDAP
222
223 dnl Check for ACL support
224 AC_NETATALK_ACL
225
226 dnl Check for Extended Attributes support
227 AC_NETATALK_EXTENDED_ATTRIBUTES
228
229 dnl Check for libsmbsharemodes from Samba for Samba/Netatalk access/deny/share modes interop
230 AC_NETATALK_SMB_SHAREMODES
231
232 dnl Check if realpath() takes NULL
233 AC_NETATALK_REALPATH
234
235 dnl Check for sendfile()
236 AC_NETATALK_SENDFILE
237
238 AC_ARG_ENABLE(redhat,
239         [  --enable-redhat         obsoleted ],[
240         echo "ERROR: --enable-redhat is obsoleted. Use --enable-redhat-sysv or --enable-redhat-systemd."
241         exit 1
242         ]
243 )
244
245 AC_ARG_ENABLE(redhat-sysv,
246         [  --enable-redhat-sysv    use redhat-style sysv (upstart) configuration ],[
247         if test "$enableval" = "yes"; then
248                 sysv_style=redhat-sysv
249         fi
250         AC_MSG_RESULT([enabling redhat-style sysv support])
251         ]
252 )
253
254 AC_ARG_ENABLE(redhat-systemd,
255         [  --enable-redhat-systemd use redhat-style systemd (>=Fedora15) configuration ],[
256         if test "$enableval" = "yes"; then
257                 sysv_style=redhat-systemd
258         fi
259         AC_MSG_RESULT([enabling redhat-style systemd support])
260         ]
261 )
262
263 AC_ARG_ENABLE(suse,
264         [  --enable-suse           obsoleted ],[
265         echo "ERROR: --enable-suse is obsoleted. Use --enable-suse-sysv or --enable-suse-systemd."
266         exit 1
267         ]
268 )
269
270 AC_ARG_ENABLE(suse-sysv,
271         [  --enable-suse-sysv      use suse-style sysv configuration ],[
272         if test "$enableval" = "yes"; then
273                 sysv_style=suse-sysv
274         fi
275         AC_MSG_RESULT([enabling suse-style sysv support])
276         ]
277 )
278
279 AC_ARG_ENABLE(suse-systemd,
280         [  --enable-suse-systemd   use suse-style systemd (>=openSUSE12.1) configuration ],[
281         if test "$enableval" = "yes"; then
282                 sysv_style=suse-systemd
283         fi
284         AC_MSG_RESULT([enabling suse-style systemd support])
285         ]
286 )
287
288 AC_ARG_ENABLE(gentoo,
289         [  --enable-gentoo         use gentoo-style sysv configuration ],[
290         if test "$enableval" = "yes"; then
291                 sysv_style=gentoo
292         fi
293         AC_MSG_RESULT([enabling gentoo-style sysv support])
294         ]
295 )
296
297 AC_ARG_ENABLE(netbsd,
298         [  --enable-netbsd         use NetBSD-style rc.d configuration ],
299         if test "x$enableval" = "xyes"; then
300                 sysv_style=netbsd
301         fi
302         AC_MSG_RESULT([enabling NetBSD-style rc.d support])
303 )
304
305 AC_ARG_ENABLE(debian,
306         [  --enable-debian         use debian-style sysv configuration ],[
307         if test "$enableval" = "yes"; then
308                 sysv_style=debian
309         fi
310         AC_MSG_RESULT([enabling debian-style sysv support])
311         ]
312 )
313
314 AC_ARG_ENABLE(systemd,
315         [  --enable-systemd        use general systemd configuration],[
316         if test "$enableval" = "yes"; then
317                 sysv_style=systemd
318         fi
319         AC_MSG_RESULT([enabling general systemd support])
320         ]
321 )
322
323 dnl --------------------------------------------------------------------------
324 dnl FHS stuff has to be done last because it overrides other defaults
325 dnl --------------------------------------------------------------------------
326
327 AC_MSG_CHECKING([whether to use Filesystem Hierarchy Standard (FHS) compatibility])
328 AC_ARG_ENABLE(fhs,
329         [  --enable-fhs            use Filesystem Hierarchy Standard (FHS) compatibility],[
330         if test "$enableval" = "yes"; then
331                 uams_path="${libdir}/netatalk"
332                 sysconfdir="/etc"
333                 PKGCONFDIR=${sysconfdir}/netatalk
334                 SERVERTEXT="${PKGCONFDIR}/msg"
335                 use_pam_so=yes
336                 mandir="/usr/share/man"
337                 AC_DEFINE(FHS_COMPATIBILITY, 1, [Define if you want compatibily with the FHS])
338                 AC_MSG_RESULT([yes])
339         else
340                 AC_MSG_RESULT([no])
341         fi
342         ],[
343                 AC_MSG_RESULT([no])
344         ]
345 )
346
347 dnl --------------------------------------------------------------------------
348 dnl post-FHS substitutions, etc
349 dnl --------------------------------------------------------------------------
350
351 UAMS_PATH="${uams_path}"
352 AC_SUBST(UAMS_PATH)
353
354 dnl --------------------------------------------------------------------------
355 dnl drop in includes for top level directory structures here...
356 dnl --------------------------------------------------------------------------
357
358 dnl Note: $(top_srcdir)/include should be added before all other includes
359 dnl       so that includes from that directory a preferred to includes from
360 dnl       /usr/include or similar places.
361 LIBS="$LIBS -L\$(top_srcdir)/libatalk"
362 CFLAGS="-I\$(top_srcdir)/include -I\$(top_srcdir)/sys $CFLAGS"
363
364
365 dnl --------------------------------------------------------------------------
366 dnl Last minute substitutions
367 dnl --------------------------------------------------------------------------
368
369 dnl ac_cv_target_os is now host_os, ac_cv_target_cpu is now host_cpu
370 AC_SUBST(LIBS)
371 AC_SUBST(CFLAGS)
372
373 AM_CONDITIONAL(SOLARIS_MODULE, test x$solaris_module = xyes)
374 AM_CONDITIONAL(HAVE_LIBGCRYPT, test x$neta_cv_have_libgcrypt = xyes)
375 AM_CONDITIONAL(HAVE_OPENSSL, test x$neta_cv_have_openssl = xyes)
376 AM_CONDITIONAL(HAVE_ACLS, test x"$with_acl_support" = x"yes")
377 AM_CONDITIONAL(HAVE_LDAP, test x"$with_ldap" = x"yes")
378 AM_CONDITIONAL(USE_DHX, test x$neta_cv_compile_dhx = xyes)
379 AM_CONDITIONAL(USE_DHX2, test x$neta_cv_compile_dhx2 = xyes)
380 AM_CONDITIONAL(USE_RANDNUM, test x$neta_cv_have_openssl = xyes)
381 AM_CONDITIONAL(USE_PAM_SO, test x$use_pam_so = xyes)
382 AM_CONDITIONAL(USE_PAM, test x$netatalk_cv_install_pam = xyes)
383 AM_CONDITIONAL(BUILD_PAM, test x$compile_pam = xyes)
384 AM_CONDITIONAL(USE_PGP, test x$compile_pgp = xyes)
385 AM_CONDITIONAL(DEFAULT_HOOK, test x$neta_cv_have_libgcrypt != xyes && test x$neta_cv_have_openssl != xyes)
386 AM_CONDITIONAL(USE_BDB, test x$bdb_required = xyes)
387 AM_CONDITIONAL(HAVE_ATFUNCS, test x"$ac_neta_haveatfuncs" = x"yes")
388
389 AM_CONDITIONAL(USE_NETBSD, test x$sysv_style = xnetbsd)
390 AM_CONDITIONAL(USE_REDHAT_SYSV, test x$sysv_style = xredhat-sysv)
391 AM_CONDITIONAL(USE_SUSE_SYSV, test x$sysv_style = xsuse-sysv)
392 AM_CONDITIONAL(USE_TRU64, test x$sysv_style = xtru64)
393 AM_CONDITIONAL(USE_SOLARIS, test x$sysv_style = xsolaris)
394 AM_CONDITIONAL(USE_GENTOO, test x$sysv_style = xgentoo)
395 AM_CONDITIONAL(USE_DEBIAN, test x$sysv_style = xdebian)
396 AM_CONDITIONAL(USE_SYSTEMD, test x$sysv_style = xsystemd || test x$sysv_style = xredhat-systemd || test x$sysv_style = xsuse-systemd)
397 AM_CONDITIONAL(USE_UNDEF, test x$sysv_style = x)
398
399
400 dnl --------------------- generate files
401
402 AC_OUTPUT([Makefile
403         bin/Makefile
404         bin/ad/Makefile
405         bin/afppasswd/Makefile
406         bin/cnid/Makefile
407         bin/cnid/cnid2_create
408         bin/megatron/Makefile
409         bin/misc/Makefile
410         bin/uniconv/Makefile
411         config/Makefile
412         config/pam/Makefile
413         contrib/Makefile
414         contrib/macusers/Makefile
415         contrib/macusers/macusers
416         contrib/shell_utils/Makefile
417         contrib/shell_utils/apple_dump
418         contrib/shell_utils/asip-status.pl
419         distrib/Makefile
420         distrib/config/Makefile
421         distrib/config/netatalk-config
422         distrib/initscripts/Makefile
423         distrib/m4/Makefile
424         doc/Makefile
425         etc/Makefile
426         etc/afpd/Makefile
427         etc/cnid_dbd/Makefile
428         etc/uams/Makefile
429         include/Makefile
430         include/atalk/Makefile
431         libatalk/Makefile
432         libatalk/acl/Makefile
433         libatalk/adouble/Makefile
434         libatalk/bstring/Makefile
435         libatalk/cnid/Makefile
436         libatalk/cnid/cdb/Makefile
437         libatalk/cnid/last/Makefile
438         libatalk/cnid/dbd/Makefile
439         libatalk/cnid/tdb/Makefile
440         libatalk/compat/Makefile
441         libatalk/dsi/Makefile
442         libatalk/iniparser/Makefile
443         libatalk/tdb/Makefile
444         libatalk/unicode/Makefile
445         libatalk/unicode/charsets/Makefile
446         libatalk/util/Makefile
447         libatalk/vfs/Makefile
448         macros/Makefile
449         man/Makefile
450         man/man1/Makefile
451         man/man5/Makefile
452         man/man8/Makefile
453         test/Makefile
454         test/afpd/Makefile
455         ],
456         [chmod a+x distrib/config/netatalk-config contrib/shell_utils/apple_*]
457 )
458
459 AC_NETATALK_LIBS_SUMMARY
460 AC_NETATALK_CONFIG_SUMMARY