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