]> arthur.barton.de Git - netatalk.git/blob - configure.ac
709107884ab30a1cad566021a904045bac2bf26e
[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 Check if we can use attribute unused (gcc only) from ethereal
31 AC_MSG_CHECKING(to see if we can add '__attribute__((unused))' to CFLAGS)
32 if test x$GCC != x ; then
33   CFLAGS="-D_U_=\"__attribute__((unused))\" $CFLAGS"
34   AC_MSG_RESULT(yes)
35 else
36   CFLAGS="-D_U_=\"\" $CFLAGS"
37   AC_MSG_RESULT(no)
38 fi
39
40 dnl Checks for header files, some checks are obsolete, unfortunately the code
41 dnl uses the resulting macros, so the code has to cleaned up too before
42 dnl we can remove the checks here.
43 AC_CHECK_HEADERS(mntent.h unistd.h termios.h ufs/quota.h)
44 AC_CHECK_HEADERS(netdb.h sgtty.h statfs.h dlfcn.h langinfo.h locale.h)
45 AC_CHECK_HEADERS(sys/param.h sys/fcntl.h sys/termios.h)
46 AC_CHECK_HEADERS(sys/mnttab.h sys/statvfs.h sys/stat.h sys/vfs.h)
47 dnl Checks for header files, confirmed to be required as of 2011
48 AC_CHECK_HEADERS(sys/epoll.h)
49 AC_CHECK_HEADERS([sys/mount.h], , , 
50 [#ifdef HAVE_SYS_PARAM_H
51 #include <sys/param.h>
52 #endif
53 ])
54
55 AC_SYS_LARGEFILE([], AC_MSG_ERROR([AFP 3.x support requires Large File Support.]))
56
57 dnl --------------------------------------------------------------------------
58 dnl check if dlsym needs to add an underscore, uses libtool macros 
59 dnl --------------------------------------------------------------------------
60 AC_LTDL_DLLIB
61 AC_CHECK_FUNCS(dlopen dlsym dlclose)
62 AC_LTDL_DLSYM_USCORE
63 if test x"$libltdl_cv_need_uscore" = xyes; then
64     AC_DEFINE(DLSYM_PREPEND_UNDERSCORE, 1, [BSD compatibility macro])
65 fi
66
67 dnl Special hecks
68 ac_neta_haveatfuncs=yes
69 AC_CHECK_FUNCS(openat renameat fstatat unlinkat, , ac_neta_haveatfuncs=no)
70 if test x"$ac_neta_haveatfuncs" = x"yes" ; then
71    AC_DEFINE([_ATFILE_SOURCE], 1, AT file source)
72    AC_DEFINE([HAVE_ATFUNCS], 1, whether at funcs are available)
73 fi
74 AC_CHECK_MEMBERS(struct tm.tm_gmtoff,,, [#include <time.h>])
75
76 dnl these tests have been comfirmed to be needed in 2011
77 AC_CHECK_FUNC(epoll_create, AC_DEFINE([HAVE_EPOLL], 1, Whether Linux epoll is available)) 
78 AC_CHECK_FUNCS(backtrace_symbols dirfd getusershell pread pwrite pselect)
79 AC_CHECK_FUNCS(setlinebuf strlcat strlcpy strnlen)
80 AC_CHECK_FUNCS(mmap utime getpagesize) dnl needed by tbd
81
82 dnl search for necessary libraries
83 AC_SEARCH_LIBS(gethostbyname, nsl)
84 AC_SEARCH_LIBS(connect, socket)
85 AC_SEARCH_LIBS(pthread_sigmask, pthread,,[AC_MSG_ERROR([missing pthread_sigmask])])
86 if test x"$ac_cv_search_pthread_sigmask" != x"none required" ; then
87    PTHREAD_LIBS=$ac_cv_search_pthread_sigmask
88 fi
89 AC_SUBST(PTHREAD_LIBS)
90
91 AC_DEFINE(OPEN_NOFOLLOW_ERRNO, ELOOP, errno returned by open with O_NOFOLLOW)
92
93 AC_CACHE_SAVE
94
95 dnl --------------------------------------------------------------------------
96 dnl 64bit platform check
97 dnl --------------------------------------------------------------------------
98
99 AC_MSG_CHECKING([whether to check for 64bit libraries])
100 # Test if the compiler is in 64bit mode
101 echo 'int i;' > conftest.$ac_ext
102 atalk_cv_cc_64bit_output=no
103 if AC_TRY_EVAL(ac_compile); then
104     case `/usr/bin/file conftest.$ac_objext` in
105     *"ELF 64"*)
106       atalk_cv_cc_64bit_output=yes
107       ;;
108     esac
109 fi
110 rm -rf conftest*
111
112 case $host_cpu:$atalk_cv_cc_64bit_output in
113 powerpc64:yes | s390x:yes | sparc*:yes | x86_64:yes | i386:yes)
114     case $target_os in
115     solaris2*)
116         AC_MSG_RESULT([yes])
117         atalk_libname="lib/64"
118         ;;
119     *bsd* | dragonfly*)
120         AC_MSG_RESULT([no])
121         atalk_libname="lib"
122         ;;
123     *)
124         AC_MSG_RESULT([yes])
125         atalk_libname="lib64"
126         ;;
127     esac
128     ;;
129 *:*)
130     AC_MSG_RESULT([no])
131     atalk_libname="lib"
132     ;;
133 esac
134
135 dnl --------------------------------------------------------------------------
136 dnl OS specific configuration comes in here:
137 dnl --------------------------------------------------------------------------
138
139 AC_NETATALK_OS_SPECIFIC
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 Zeroconf support
173 AC_NETATALK_ZEROCONF
174
175 dnl Check for optional TCP-wrappers support
176 AC_NETATALK_TCP_WRAPPERS
177
178 dnl Check for PAM libs
179 AC_NETATALK_PATH_PAM
180
181 dnl Check for optional shadow password support
182 AC_NETATALK_SHADOW
183         
184 dnl Check for optional valid-shell-check support
185 AC_NETATALK_SHELL_CHECK
186
187 dnl Check for optional Webmin
188 AC_NETATALK_WEBMIN
189
190 dnl Check for optional sysv initscript install
191 AC_NETATALK_SYSV_STYLE
192
193 dnl Path where UAM modules shall be installed
194 AC_ARG_WITH(uams-path, [  --with-uams-path=PATH   path to UAMs [[PKGCONF/uams]]], [uams_path="$withval"], [uams_path="${PKGCONFDIR}/uams"])
195
196 dnl Check for libgcrypt, if found enables DHX2 UAM
197 AC_NETATALK_PATH_LIBGCRYPT([1:1.2.3])
198
199 dnl Check for openssl, if found enables DHX UAM and Randnum UAM
200 AC_NETATALK_PATH_SSL
201
202 dnl Check for Berkeley DB library
203 AC_NETATALK_PATH_BDB
204
205 dnl Check for crypt
206 AC_NETATALK_CRYPT
207
208 dnl Check for building PGP UAM module
209 AC_NETATALK_PGP_UAM
210
211 dnl Check for building Kerberos V UAM module
212 AC_NETATALK_KRB5_UAM
213
214 dnl Check for overwrite the config files or not
215 AC_NETATALK_OVERWRITE_CONFIG
216
217 dnl Check for LDAP support, for client-side ACL visibility
218 AC_NETATALK_LDAP
219
220 dnl Check for ACL support
221 AC_NETATALK_ACL
222
223 dnl Check for Extended Attributes support
224 AC_NETATALK_EXTENDED_ATTRIBUTES
225
226 dnl Check for libsmbsharemodes from Samba for Samba/Netatalk access/deny/share modes interop
227 AC_NETATALK_SMB_SHAREMODES
228
229 dnl Check if realpath() takes NULL
230 AC_NETATALK_REALPATH
231
232 dnl Check for sendfile()
233 AC_NETATALK_SENDFILE
234
235 dnl --------------------------------------------------------------------------
236 dnl FHS stuff has to be done last because it overrides other defaults
237 dnl --------------------------------------------------------------------------
238
239 AC_MSG_CHECKING([whether to use Filesystem Hierarchy Standard (FHS) compatibility])
240 AC_ARG_ENABLE(fhs,
241         [  --enable-fhs            use Filesystem Hierarchy Standard (FHS) compatibility],[
242         if test "$enableval" = "yes"; then
243                 uams_path="${libdir}/netatalk"
244                 sysconfdir="/etc"
245                 PKGCONFDIR=${sysconfdir}/netatalk
246                 SERVERTEXT="${PKGCONFDIR}/msg"
247                 use_pam_so=yes
248                 mandir="/usr/share/man"
249                 AC_DEFINE(FHS_COMPATIBILITY, 1, [Define if you want compatibily with the FHS])
250                 AC_MSG_RESULT([yes])
251         else
252                 AC_MSG_RESULT([no])
253         fi
254         ],[
255                 AC_MSG_RESULT([no])
256         ]
257 )
258
259 dnl --------------------------------------------------------------------------
260 dnl post-FHS substitutions, etc
261 dnl --------------------------------------------------------------------------
262
263 UAMS_PATH="${uams_path}"
264 AC_SUBST(UAMS_PATH)
265
266 dnl --------------------------------------------------------------------------
267 dnl drop in includes for top level directory structures here...
268 dnl --------------------------------------------------------------------------
269
270 dnl Note: $(top_srcdir)/include should be added before all other includes
271 dnl       so that includes from that directory a preferred to includes from
272 dnl       /usr/include or similar places.
273 LIBS="$LIBS -L\$(top_srcdir)/libatalk"
274 CFLAGS="-I\$(top_srcdir)/include -I\$(top_srcdir)/sys $CFLAGS"
275
276
277 dnl --------------------------------------------------------------------------
278 dnl Last minute substitutions
279 dnl --------------------------------------------------------------------------
280
281 dnl ac_cv_target_os is now host_os, ac_cv_target_cpu is now host_cpu
282 AC_SUBST(LIBS)
283 AC_SUBST(CFLAGS)
284
285 AM_CONDITIONAL(SOLARIS_MODULE, test x$solaris_module = xyes)
286 AM_CONDITIONAL(HAVE_LIBGCRYPT, test x$neta_cv_have_libgcrypt = xyes)
287 AM_CONDITIONAL(HAVE_OPENSSL, test x$neta_cv_have_openssl = xyes)
288 AM_CONDITIONAL(HAVE_ACLS, test x"$with_acl_support" = x"yes")
289 AM_CONDITIONAL(HAVE_LDAP, test x"$with_ldap" = x"yes")
290 AM_CONDITIONAL(USE_DHX, test x$neta_cv_compile_dhx = xyes)
291 AM_CONDITIONAL(USE_DHX2, test x$neta_cv_compile_dhx2 = xyes)
292 AM_CONDITIONAL(USE_RANDNUM, test x$neta_cv_have_openssl = xyes)
293 AM_CONDITIONAL(USE_PAM_SO, test x$use_pam_so = xyes)
294 AM_CONDITIONAL(USE_PAM, test x$netatalk_cv_install_pam = xyes)
295 AM_CONDITIONAL(BUILD_PAM, test x$compile_pam = xyes)
296 AM_CONDITIONAL(USE_PGP, test x$compile_pgp = xyes)
297 AM_CONDITIONAL(DEFAULT_HOOK, test x$neta_cv_have_libgcrypt != xyes && test x$neta_cv_have_openssl != xyes)
298 AM_CONDITIONAL(USE_BDB, test x$bdb_required = xyes)
299 AM_CONDITIONAL(HAVE_ATFUNCS, test x"$ac_neta_haveatfuncs" = x"yes")
300
301 dnl --------------------- generate files
302
303 AC_OUTPUT([Makefile
304         bin/Makefile
305         bin/ad/Makefile
306         bin/afppasswd/Makefile
307         bin/cnid/Makefile
308         bin/cnid/cnid2_create
309         bin/megatron/Makefile
310         bin/misc/Makefile
311         bin/uniconv/Makefile
312         config/Makefile
313         config/pam/Makefile
314         contrib/Makefile
315         contrib/macusers/Makefile
316         contrib/macusers/macusers
317         contrib/shell_utils/Makefile
318         contrib/shell_utils/apple_dump
319         contrib/shell_utils/asip-status.pl
320         distrib/Makefile
321         distrib/config/Makefile
322         distrib/config/netatalk-config
323         distrib/initscripts/Makefile
324         distrib/m4/Makefile
325         doc/Makefile
326         etc/Makefile
327         etc/afpd/Makefile
328         etc/cnid_dbd/Makefile
329         etc/uams/Makefile
330         include/Makefile
331         include/atalk/Makefile
332         libatalk/Makefile
333         libatalk/acl/Makefile
334         libatalk/adouble/Makefile
335         libatalk/bstring/Makefile
336         libatalk/cnid/Makefile
337         libatalk/cnid/cdb/Makefile
338         libatalk/cnid/last/Makefile
339         libatalk/cnid/dbd/Makefile
340         libatalk/cnid/tdb/Makefile
341         libatalk/compat/Makefile
342         libatalk/dsi/Makefile
343         libatalk/iniparser/Makefile
344         libatalk/tdb/Makefile
345         libatalk/unicode/Makefile
346         libatalk/unicode/charsets/Makefile
347         libatalk/util/Makefile
348         libatalk/vfs/Makefile
349         macros/Makefile
350         man/Makefile
351         man/man1/Makefile
352         man/man5/Makefile
353         man/man8/Makefile
354         test/Makefile
355         test/afpd/Makefile
356         ],
357         [chmod a+x distrib/config/netatalk-config contrib/shell_utils/apple_*]
358 )
359
360 AC_NETATALK_LIBS_SUMMARY
361 AC_NETATALK_CONFIG_SUMMARY