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