]> arthur.barton.de Git - netatalk.git/blob - configure.in
Merge master
[netatalk.git] / configure.in
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 dnl --------------------- Check if realpath() takes NULL
98 AC_CACHE_CHECK([if the realpath function allows a NULL argument],
99     neta_cv_REALPATH_TAKES_NULL, [
100         AC_TRY_RUN([
101             #include <stdio.h>
102             #include <limits.h>
103             #include <signal.h>
104
105             void exit_on_core(int ignored) {
106                  exit(1);
107             }
108
109             main() {
110                 char *newpath;
111                 signal(SIGSEGV, exit_on_core);
112                 newpath = realpath("/tmp", NULL);
113                 exit((newpath != NULL) ? 0 : 1);
114             }],
115             neta_cv_REALPATH_TAKES_NULL=yes,
116             neta_cv_REALPATH_TAKES_NULL=no,
117             neta_cv_REALPATH_TAKES_NULL=cross
118         )
119     ]
120 )
121
122 if test x"$neta_cv_REALPATH_TAKES_NULL" = x"yes"; then
123     AC_DEFINE(REALPATH_TAKES_NULL,1,[Whether the realpath function allows NULL])
124 fi
125
126 AC_CACHE_SAVE
127
128 dnl --------------------------------------------------------------------------
129 dnl 64bit platform check
130 dnl --------------------------------------------------------------------------
131
132 AC_MSG_CHECKING([whether to check for 64bit libraries])
133 # Test if the compiler is in 64bit mode
134 echo 'int i;' > conftest.$ac_ext
135 atalk_cv_cc_64bit_output=no
136 if AC_TRY_EVAL(ac_compile); then
137     case `/usr/bin/file conftest.$ac_objext` in
138     *"ELF 64"*)
139       atalk_cv_cc_64bit_output=yes
140       ;;
141     esac
142 fi
143 rm -rf conftest*
144
145 case $host_cpu:$atalk_cv_cc_64bit_output in
146 powerpc64:yes | s390x:yes | sparc*:yes | x86_64:yes | i386:yes)
147     AC_MSG_RESULT([yes])
148     case $target_os in
149     solaris2*)
150         atalk_libname="lib/64"
151         ;;
152     *)
153         atalk_libname="lib64"
154         ;;
155     esac
156     ;;
157 *:*)
158     AC_MSG_RESULT([no])
159     atalk_libname="lib"
160     ;;
161 esac
162
163 dnl --------------------------------------------------------------------------
164 dnl specific configuration comes in here:
165 dnl --------------------------------------------------------------------------
166
167 dnl Check for optional admin group support
168 AC_NETATALK_ADMIN_GROUP
169
170 dnl Check for optional AFS support
171 AC_NETATALK_AFS_CHECK
172
173 dnl --with-pkgconfdir check to change configuration directory location
174 AC_NETATALK_CONFIG_DIRS
175
176 dnl Check for optional cracklib support
177 AC_NETATALK_CRACKLIB
178
179 dnl Check whether to enable debug code
180 AC_NETATALK_DEBUG
181
182 dnl Check whethe to disable tickle SIGALARM stuff, which eases debugging
183 AC_NETATALK_DEBUGGING
184
185 dnl     Check for libiconv support
186 AC_NETATALK_CHECK_ICONV
187
188 dnl Check for CNID database backends
189 AC_NETATALK_CNID([bdb_required=yes],[bdb_required=no])
190
191 dnl Check for quota support
192 AC_NETATALK_CHECK_QUOTA
193
194 dnl Check for optional server location protocol support (used by MacOS X)
195 AC_NETATALK_SRVLOC
196
197 dnl Check for optional Zeroconf support
198 AC_NETATALK_ZEROCONF
199
200 dnl Check for optional TCP-wrappers support
201 AC_NETATALK_TCP_WRAPPERS
202
203 dnl Check for PAM libs
204 AC_NETATALK_PATH_PAM
205
206 dnl Check for optional shadow password support
207 AC_NETATALK_SHADOW
208         
209 dnl Check for optional valid-shell-check support
210 AC_NETATALK_SHELL_CHECK
211
212 dnl Check for optional Webmin
213 AC_NETATALK_WEBMIN
214
215 dnl Check for optional sysv initscript install
216 AC_NETATALK_SYSV_STYLE
217
218 dnl Path where UAM modules shall be installed
219 AC_ARG_WITH(uams-path, [  --with-uams-path=PATH   path to UAMs [[PKGCONF/uams]]], [uams_path="$withval"], [uams_path="${PKGCONFDIR}/uams"])
220
221 dnl Check for libgcrypt, if found enables DHX2 UAM
222 AC_NETATALK_PATH_LIBGCRYPT([1:1.2.3])
223
224 dnl Check for openssl, if found enables DHX UAM and Randnum UAM
225 AC_NETATALK_PATH_SSL
226
227 dnl Check for Berkeley DB library
228 AC_NETATALK_PATH_BDB
229
230 dnl Check for crypt
231 AC_NETATALK_CRYPT
232
233 dnl Check for building PGP UAM module
234 AC_NETATALK_PGP_UAM
235
236 dnl Check for building Kerberos V UAM module
237 AC_NETATALK_KRB5_UAM
238
239 dnl Check for overwrite the config files or not
240 AC_NETATALK_OVERWRITE_CONFIG
241
242 dnl Check for LDAP support, for client-side ACL visibility
243 AC_NETATALK_LDAP
244
245 dnl Check for ACL support
246 AC_NETATALK_ACL
247
248 dnl Check for Extended Attributes support
249 AC_NETATALK_EXTENDED_ATTRIBUTES
250
251 dnl Check for libsmbsharemodes from Samba for Samba/Netatalk access/deny/share modes interop
252 AC_NETATALK_SMB_SHAREMODES
253
254 dnl --------------------------------------------------------------------------
255 dnl FHS stuff has to be done last because it overrides other defaults
256 dnl --------------------------------------------------------------------------
257
258 AC_MSG_CHECKING([whether to use Filesystem Hierarchy Standard (FHS) compatibility])
259 AC_ARG_ENABLE(fhs,
260         [  --enable-fhs            use Filesystem Hierarchy Standard (FHS) compatibility],[
261         if test "$enableval" = "yes"; then
262                 uams_path="${libdir}/netatalk"
263                 sysconfdir="/etc"
264                 PKGCONFDIR=${sysconfdir}/netatalk
265                 SERVERTEXT="${PKGCONFDIR}/msg"
266                 use_pam_so=yes
267                 mandir="/usr/share/man"
268                 AC_DEFINE(FHS_COMPATIBILITY, 1, [Define if you want compatibily with the FHS])
269                 AC_MSG_RESULT([yes])
270         else
271                 AC_MSG_RESULT([no])
272         fi
273         ],[
274                 AC_MSG_RESULT([no])
275         ]
276 )
277
278 dnl --------------------------------------------------------------------------
279 dnl post-FHS substitutions, etc
280 dnl --------------------------------------------------------------------------
281
282 UAMS_PATH="${uams_path}"
283 AC_SUBST(UAMS_PATH)
284
285
286 dnl --------------------------------------------------------------------------
287 dnl OS specific configuration comes in here:
288 dnl --------------------------------------------------------------------------
289
290 AC_NETATALK_OS_SPECIFIC
291
292
293 dnl --------------------------------------------------------------------------
294 dnl drop in includes for top level directory structures here...
295 dnl --------------------------------------------------------------------------
296
297 dnl Note: $(top_srcdir)/include should be added before all other includes
298 dnl       so that includes from that directory a preferred to includes from
299 dnl       /usr/include or similar places.
300 LIBS="$LIBS -L\$(top_srcdir)/libatalk -L\$(top_srcdir)/libevent"
301 CFLAGS="-I\$(top_srcdir)/include -I\$(top_srcdir)/sys -I\$(top_srcdir)/libevent/include $CFLAGS"
302
303 AC_DEFINE(OPEN_NOFOLLOW_ERRNO, ELOOP, errno returned by open with O_NOFOLLOW)
304
305
306 dnl --------------------------------------------------------------------------
307 dnl Last minute substitutions
308 dnl --------------------------------------------------------------------------
309
310 AC_SUBST(LIBS)
311 AC_SUBST(CFLAGS)
312
313 AM_CONDITIONAL(SOLARIS_MODULE, test x$solaris_module = xyes)
314 AM_CONDITIONAL(HAVE_LIBGCRYPT, test x$neta_cv_have_libgcrypt = xyes)
315 AM_CONDITIONAL(HAVE_OPENSSL, test x$neta_cv_have_openssl = xyes)
316 AM_CONDITIONAL(HAVE_ACLS, test x"$with_acl_support" = x"yes")
317 AM_CONDITIONAL(HAVE_LDAP, test x"$with_ldap" = x"yes")
318 AM_CONDITIONAL(USE_DHX, test x$neta_cv_compile_dhx = xyes)
319 AM_CONDITIONAL(USE_DHX2, test x$neta_cv_compile_dhx2 = xyes)
320 AM_CONDITIONAL(USE_RANDNUM, test x$neta_cv_have_openssl = xyes)
321 AM_CONDITIONAL(USE_PAM_SO, test x$use_pam_so = xyes)
322 AM_CONDITIONAL(USE_PAM, test x$netatalk_cv_install_pam = xyes)
323 AM_CONDITIONAL(BUILD_PAM, test x$compile_pam = xyes)
324 AM_CONDITIONAL(USE_PGP, test x$compile_pgp = xyes)
325 AM_CONDITIONAL(DEFAULT_HOOK, test x$neta_cv_have_libgcrypt != xyes && test x$neta_cv_have_openssl != xyes)
326 AM_CONDITIONAL(USE_NETBSD, test x$sysv_style = xnetbsd)
327 AM_CONDITIONAL(USE_REDHAT_SYSV, test x$sysv_style = xredhat-sysv)
328 AM_CONDITIONAL(USE_REDHAT_SYSTEMD, test x$sysv_style = xredhat-systemd)
329 AM_CONDITIONAL(USE_SUSE, test x$sysv_style = xsuse)
330 AM_CONDITIONAL(USE_SHADOWPW, test x$shadowpw = xyes)
331 AM_CONDITIONAL(USE_TRU64, test x$sysv_style = xtru64)
332 AM_CONDITIONAL(USE_SOLARIS, test x$sysv_style = xsolaris)
333 AM_CONDITIONAL(USE_GENTOO, test x$sysv_style = xgentoo)
334 AM_CONDITIONAL(USE_DEBIAN, test x$sysv_style = xdebian)
335 AM_CONDITIONAL(USE_UNDEF, test x$sysv_style = x)
336 AM_CONDITIONAL(USE_BDB, test x$bdb_required = xyes)
337 AM_CONDITIONAL(HAVE_ATFUNCS, test x"$ac_neta_haveatfuncs" = x"yes")
338
339 dnl --------------------- generate files
340
341 AC_OUTPUT([Makefile
342         bin/Makefile
343         bin/ad/Makefile
344         bin/afppasswd/Makefile
345         bin/cnid/Makefile
346         bin/cnid/cnid2_create
347         bin/megatron/Makefile
348     bin/misc/Makefile
349         bin/uniconv/Makefile
350         config/Makefile
351     config/pam/Makefile
352         contrib/Makefile
353         contrib/macusers/Makefile
354         contrib/macusers/macusers
355         contrib/shell_utils/Makefile
356         contrib/shell_utils/afpd-mtab.pl
357     contrib/shell_utils/apple_dump
358         contrib/shell_utils/asip-status.pl
359         distrib/Makefile
360         distrib/config/Makefile
361         distrib/config/netatalk-config
362         distrib/initscripts/Makefile
363         distrib/m4/Makefile
364         doc/Makefile
365         etc/Makefile
366         etc/afpd/Makefile
367         etc/cnid_dbd/Makefile
368         etc/netalockd/Makefile
369         etc/uams/Makefile
370         include/Makefile
371         include/atalk/Makefile
372         libatalk/Makefile
373         libatalk/acl/Makefile
374         libatalk/adouble/Makefile
375         libatalk/bstring/Makefile
376         libatalk/cnid/Makefile
377         libatalk/cnid/cdb/Makefile
378         libatalk/cnid/last/Makefile
379         libatalk/cnid/dbd/Makefile
380         libatalk/cnid/tdb/Makefile
381         libatalk/compat/Makefile
382         libatalk/dsi/Makefile
383         libatalk/locking/Makefile
384         libatalk/rpc/Makefile
385         libatalk/talloc/Makefile
386         libatalk/tevent/Makefile
387         libatalk/tsocket/Makefile
388         libatalk/tdb/Makefile
389         libatalk/unicode/Makefile
390         libatalk/unicode/charsets/Makefile
391         libatalk/util/Makefile
392         libatalk/vfs/Makefile
393         macros/Makefile
394         man/Makefile
395         man/man1/Makefile
396         man/man5/Makefile
397         man/man8/Makefile
398         test/Makefile
399         test/afpd/Makefile
400         test/netalockd/Makefile
401         ],
402         [chmod a+x distrib/config/netatalk-config contrib/shell_utils/apple_*]
403 )
404
405 AC_NETATALK_LIBS_SUMMARY
406 AC_NETATALK_CONFIG_SUMMARY