]> arthur.barton.de Git - netatalk.git/blob - configure.ac
Merge master
[netatalk.git] / configure.ac
1 dnl configure.in 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 Configure libevent
44 AC_CONFIG_SUBDIRS([libevent])
45
46 dnl Checks for header files, some checks are obsolete, unfortunately the code
47 dnl uses the resulting macros, so the code has to cleaned up too before
48 dnl we can remove the checks here.
49 AC_CHECK_HEADERS(mntent.h unistd.h termios.h ufs/quota.h)
50 AC_CHECK_HEADERS(netdb.h sgtty.h statfs.h dlfcn.h langinfo.h locale.h)
51 AC_CHECK_HEADERS(sys/param.h sys/fcntl.h sys/termios.h)
52 AC_CHECK_HEADERS(sys/mnttab.h sys/statvfs.h sys/stat.h sys/vfs.h)
53 dnl Checks for header files, confirmed to be required as of 2011
54 AC_CHECK_HEADERS(sys/epoll.h)
55 AC_CHECK_HEADERS([sys/mount.h], , , 
56 [#ifdef HAVE_SYS_PARAM_H
57 #include <sys/param.h>
58 #endif
59 ])
60
61 AC_SYS_LARGEFILE([], AC_MSG_ERROR([AFP 3.x support requires Large File Support.]))
62
63 dnl --------------------------------------------------------------------------
64 dnl check if dlsym needs to add an underscore, uses libtool macros 
65 dnl --------------------------------------------------------------------------
66 AC_LTDL_DLLIB
67 AC_CHECK_FUNCS(dlopen dlsym dlclose)
68 AC_LTDL_DLSYM_USCORE
69 if test x"$libltdl_cv_need_uscore" = xyes; then
70     AC_DEFINE(DLSYM_PREPEND_UNDERSCORE, 1, [BSD compatibility macro])
71 fi
72
73 dnl Special hecks
74 ac_neta_haveatfuncs=yes
75 AC_CHECK_FUNCS(openat renameat fstatat unlinkat, , ac_neta_haveatfuncs=no)
76 if test x"$ac_neta_haveatfuncs" = x"yes" ; then
77    AC_DEFINE([_ATFILE_SOURCE], 1, AT file source)
78    AC_DEFINE([HAVE_ATFUNCS], 1, whether at funcs are available)
79 fi
80 AC_CHECK_MEMBERS(struct tm.tm_gmtoff,,, [#include <time.h>])
81
82 dnl these tests have been comfirmed to be needed in 2011
83 AC_CHECK_FUNC(epoll_create, AC_DEFINE([HAVE_EPOLL], 1, Whether Linux epoll is available)) 
84 AC_CHECK_FUNCS(backtrace_symbols dirfd getusershell pread pwrite pselect)
85 AC_CHECK_FUNCS(setlinebuf strlcat strlcpy strnlen)
86 AC_CHECK_FUNCS(mmap utime getpagesize) dnl needed by tbd
87
88 dnl search for necessary libraries
89 AC_SEARCH_LIBS(gethostbyname, nsl)
90 AC_SEARCH_LIBS(connect, socket)
91 AC_SEARCH_LIBS(pthread_sigmask, pthread,,[AC_MSG_ERROR([missing pthread_sigmask])])
92 if test x"$ac_cv_search_pthread_sigmask" != x"none required" ; then
93    PTHREAD_LIBS=$ac_cv_search_pthread_sigmask
94 fi
95 AC_SUBST(PTHREAD_LIBS)
96
97 AC_DEFINE(OPEN_NOFOLLOW_ERRNO, ELOOP, errno returned by open with O_NOFOLLOW)
98
99 AC_CACHE_SAVE
100
101 dnl --------------------------------------------------------------------------
102 dnl 64bit platform check
103 dnl --------------------------------------------------------------------------
104
105 AC_MSG_CHECKING([whether to check for 64bit libraries])
106 # Test if the compiler is in 64bit mode
107 echo 'int i;' > conftest.$ac_ext
108 atalk_cv_cc_64bit_output=no
109 if AC_TRY_EVAL(ac_compile); then
110     case `/usr/bin/file conftest.$ac_objext` in
111     *"ELF 64"*)
112       atalk_cv_cc_64bit_output=yes
113       ;;
114     esac
115 fi
116 rm -rf conftest*
117
118 case $host_cpu:$atalk_cv_cc_64bit_output in
119 powerpc64:yes | s390x:yes | sparc*:yes | x86_64:yes | i386:yes)
120     case $target_os in
121     solaris2*)
122         AC_MSG_RESULT([yes])
123         atalk_libname="lib/64"
124         ;;
125     *bsd* | dragonfly*)
126         AC_MSG_RESULT([no])
127         atalk_libname="lib"
128         ;;
129     *)
130         AC_MSG_RESULT([yes])
131         atalk_libname="lib64"
132         ;;
133     esac
134     ;;
135 *:*)
136     AC_MSG_RESULT([no])
137     atalk_libname="lib"
138     ;;
139 esac
140
141 dnl --------------------------------------------------------------------------
142 dnl specific configuration comes in here:
143 dnl --------------------------------------------------------------------------
144
145 dnl Check for optional admin group support
146 AC_NETATALK_ADMIN_GROUP
147
148 dnl Check for optional AFS support
149 AC_NETATALK_AFS_CHECK
150
151 dnl --with-pkgconfdir check to change configuration directory location
152 AC_NETATALK_CONFIG_DIRS
153
154 dnl Check for optional cracklib support
155 AC_NETATALK_CRACKLIB
156
157 dnl Check whether to enable debug code
158 AC_NETATALK_DEBUG
159
160 dnl Check whethe to disable tickle SIGALARM stuff, which eases debugging
161 AC_NETATALK_DEBUGGING
162
163 dnl     Check for libiconv support
164 AC_NETATALK_CHECK_ICONV
165
166 dnl Check for CNID database backends
167 AC_NETATALK_CNID([bdb_required=yes],[bdb_required=no])
168
169 dnl Check for quota support
170 AC_NETATALK_CHECK_QUOTA
171
172 dnl Check for optional server location protocol support (used by MacOS X)
173 AC_NETATALK_SRVLOC
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 dnl --------------------------------------------------------------------------
239 dnl FHS stuff has to be done last because it overrides other defaults
240 dnl --------------------------------------------------------------------------
241
242 AC_MSG_CHECKING([whether to use Filesystem Hierarchy Standard (FHS) compatibility])
243 AC_ARG_ENABLE(fhs,
244         [  --enable-fhs            use Filesystem Hierarchy Standard (FHS) compatibility],[
245         if test "$enableval" = "yes"; then
246                 uams_path="${libdir}/netatalk"
247                 sysconfdir="/etc"
248                 PKGCONFDIR=${sysconfdir}/netatalk
249                 SERVERTEXT="${PKGCONFDIR}/msg"
250                 use_pam_so=yes
251                 mandir="/usr/share/man"
252                 AC_DEFINE(FHS_COMPATIBILITY, 1, [Define if you want compatibily with the FHS])
253                 AC_MSG_RESULT([yes])
254         else
255                 AC_MSG_RESULT([no])
256         fi
257         ],[
258                 AC_MSG_RESULT([no])
259         ]
260 )
261
262 dnl --------------------------------------------------------------------------
263 dnl post-FHS substitutions, etc
264 dnl --------------------------------------------------------------------------
265
266 UAMS_PATH="${uams_path}"
267 AC_SUBST(UAMS_PATH)
268
269
270 dnl --------------------------------------------------------------------------
271 dnl OS specific configuration comes in here:
272 dnl --------------------------------------------------------------------------
273
274 AC_NETATALK_OS_SPECIFIC
275
276
277 dnl --------------------------------------------------------------------------
278 dnl drop in includes for top level directory structures here...
279 dnl --------------------------------------------------------------------------
280
281 dnl Note: $(top_srcdir)/include should be added before all other includes
282 dnl       so that includes from that directory a preferred to includes from
283 dnl       /usr/include or similar places.
284 LIBS="$LIBS -L\$(top_srcdir)/libatalk -L\$(top_srcdir)/libevent"
285 CFLAGS="-I\$(top_srcdir)/include -I\$(top_srcdir)/sys -I\$(top_srcdir)/libevent/include $CFLAGS"
286
287
288 dnl --------------------------------------------------------------------------
289 dnl Last minute substitutions
290 dnl --------------------------------------------------------------------------
291
292 AC_SUBST(LIBS)
293 AC_SUBST(CFLAGS)
294
295 AM_CONDITIONAL(SOLARIS_MODULE, test x$solaris_module = xyes)
296 AM_CONDITIONAL(HAVE_LIBGCRYPT, test x$neta_cv_have_libgcrypt = xyes)
297 AM_CONDITIONAL(HAVE_OPENSSL, test x$neta_cv_have_openssl = xyes)
298 AM_CONDITIONAL(HAVE_ACLS, test x"$with_acl_support" = x"yes")
299 AM_CONDITIONAL(HAVE_LDAP, test x"$with_ldap" = x"yes")
300 AM_CONDITIONAL(USE_DHX, test x$neta_cv_compile_dhx = xyes)
301 AM_CONDITIONAL(USE_DHX2, test x$neta_cv_compile_dhx2 = xyes)
302 AM_CONDITIONAL(USE_RANDNUM, test x$neta_cv_have_openssl = xyes)
303 AM_CONDITIONAL(USE_PAM_SO, test x$use_pam_so = xyes)
304 AM_CONDITIONAL(USE_PAM, test x$netatalk_cv_install_pam = xyes)
305 AM_CONDITIONAL(BUILD_PAM, test x$compile_pam = xyes)
306 AM_CONDITIONAL(USE_PGP, test x$compile_pgp = xyes)
307 AM_CONDITIONAL(DEFAULT_HOOK, test x$neta_cv_have_libgcrypt != xyes && test x$neta_cv_have_openssl != xyes)
308 AM_CONDITIONAL(USE_NETBSD, test x$sysv_style = xnetbsd)
309 AM_CONDITIONAL(USE_REDHAT_SYSV, test x$sysv_style = xredhat-sysv)
310 AM_CONDITIONAL(USE_SUSE_SYSV, test x$sysv_style = xsuse-sysv)
311 AM_CONDITIONAL(USE_SHADOWPW, test x$shadowpw = xyes)
312 AM_CONDITIONAL(USE_TRU64, test x$sysv_style = xtru64)
313 AM_CONDITIONAL(USE_SOLARIS, test x$sysv_style = xsolaris)
314 AM_CONDITIONAL(USE_GENTOO, test x$sysv_style = xgentoo)
315 AM_CONDITIONAL(USE_DEBIAN, test x$sysv_style = xdebian)
316 AM_CONDITIONAL(USE_SYSTEMD, test x$sysv_style = xsystemd || test x$sysv_style = xredhat-systemd || test x$sysv_style = xsuse-systemd)
317 AM_CONDITIONAL(USE_UNDEF, test x$sysv_style = x)
318 AM_CONDITIONAL(USE_BDB, test x$bdb_required = xyes)
319 AM_CONDITIONAL(HAVE_ATFUNCS, test x"$ac_neta_haveatfuncs" = x"yes")
320
321 dnl --------------------- generate files
322
323 AC_OUTPUT([Makefile
324         bin/Makefile
325         bin/ad/Makefile
326         bin/afppasswd/Makefile
327         bin/cnid/Makefile
328         bin/cnid/cnid2_create
329         bin/megatron/Makefile
330     bin/misc/Makefile
331         bin/uniconv/Makefile
332         config/Makefile
333         config/pam/Makefile
334         contrib/Makefile
335         contrib/macusers/Makefile
336         contrib/macusers/macusers
337         contrib/shell_utils/Makefile
338         contrib/shell_utils/apple_dump
339         contrib/shell_utils/asip-status.pl
340         distrib/Makefile
341         distrib/config/Makefile
342         distrib/config/netatalk-config
343         distrib/initscripts/Makefile
344         distrib/m4/Makefile
345         distrib/systemd/Makefile
346         doc/Makefile
347         etc/Makefile
348         etc/afpd/Makefile
349         etc/cnid_dbd/Makefile
350         etc/netalockd/Makefile
351         etc/uams/Makefile
352         include/Makefile
353         include/atalk/Makefile
354         libatalk/Makefile
355         libatalk/acl/Makefile
356         libatalk/adouble/Makefile
357         libatalk/bstring/Makefile
358         libatalk/cnid/Makefile
359         libatalk/cnid/cdb/Makefile
360         libatalk/cnid/last/Makefile
361         libatalk/cnid/dbd/Makefile
362         libatalk/cnid/tdb/Makefile
363         libatalk/compat/Makefile
364         libatalk/dsi/Makefile
365         libatalk/locking/Makefile
366         libatalk/rpc/Makefile
367         libatalk/talloc/Makefile
368         libatalk/tevent/Makefile
369         libatalk/tsocket/Makefile
370         libatalk/tdb/Makefile
371         libatalk/unicode/Makefile
372         libatalk/unicode/charsets/Makefile
373         libatalk/util/Makefile
374         libatalk/vfs/Makefile
375         macros/Makefile
376         man/Makefile
377         man/man1/Makefile
378         man/man5/Makefile
379         man/man8/Makefile
380         test/Makefile
381         test/afpd/Makefile
382         test/netalockd/Makefile
383         ],
384         [chmod a+x distrib/config/netatalk-config contrib/shell_utils/apple_*]
385 )
386
387 AC_NETATALK_LIBS_SUMMARY
388 AC_NETATALK_CONFIG_SUMMARY