]> arthur.barton.de Git - netatalk.git/blob - macros/netatalk.m4
Move and rename Spotlight module
[netatalk.git] / macros / netatalk.m4
1 dnl Kitchen sink for configuration macros
2
3 dnl Whether to enable developer build
4 AC_DEFUN([AC_DEVELOPER], [
5     AC_MSG_CHECKING([whether to enable developer build])
6     AC_ARG_ENABLE(
7         developer,
8         AS_HELP_STRING([--enable-developer], [whether to enable developer build (ABI checking)]),
9         enable_dev=$enableval,
10         enable_dev=no
11     )
12     AC_MSG_RESULT([$enable_dev])
13     AM_CONDITIONAL(DEVELOPER, test x"$enable_dev" = x"yes")
14 ])
15
16 dnl Tracker, for Spotlight
17 AC_DEFUN([AC_NETATALK_SPOTLIGHT], [
18     ac_cv_tracker_pkg_default=tracker-sparql-0.12
19     AC_ARG_WITH([tracker-pkg-config],
20         [AS_HELP_STRING([--with-tracker-pkg-config],[name of the Tracker SPARQL pkg in pkg-config])],
21         [ac_cv_tracker_pkg=$withval],
22         [ac_cv_tracker_pkg=$ac_cv_tracker_pkg_default])
23
24     AC_MSG_NOTICE([searching for $ac_cv_tracker_pkg])
25
26     PKG_CHECK_MODULES([TRACKER], [$ac_cv_tracker_pkg >= 0.12], [ac_cv_have_tracker=yes], [ac_cv_have_tracker=no])
27
28     if test x"$ac_cv_have_tracker" = x"no" ; then
29         if test x"$need_tracker" = x"yes" ; then
30             AC_MSG_ERROR([$ac_cv_tracker_pkg not found])
31         fi
32     else
33         AC_DEFINE(HAVE_TRACKER, 1, [Define if Tracker library is available])
34         ac_cv_tracker_prefix=`pkg-config --variable=prefix $ac_cv_tracker_pkg`
35         AC_DEFINE_UNQUOTED(TRACKER_PREFIX, ["$ac_cv_tracker_prefix"], [Path to Tracker])
36         fi
37
38     AC_SUBST(TRACKER_CFLAGS)
39     AC_SUBST(TRACKER_LIBS)
40     AM_CONDITIONAL(HAVE_TRACKER_SPARQL, [test x"$ac_cv_have_tracker" = x"yes"])
41
42     ac_cv_tracker_miner_pkg_default=tracker-miner-0.12
43     AC_ARG_WITH([tracker-miner-pkg-config],
44         [AS_HELP_STRING([--with-tracker-miner-pkg-config],[name of the Tracker miner pkg in pkg-config])],
45         [ac_cv_tracker_miner_pkg=$withval],
46         [ac_cv_tracker_miner_pkg=$ac_cv_tracker_miner_pkg_default])
47
48     AC_MSG_NOTICE([searching for $ac_cv_tracker_miner_pkg])
49
50     PKG_CHECK_MODULES([TRACKER_MINER], [$ac_cv_tracker_miner_pkg >= 0.12], [ac_cv_have_tracker_miner=yes], [ac_cv_have_tracker_miner=no])
51
52     if test x"$ac_cv_have_tracker_miner" = x"yes" ; then
53         AC_DEFINE(HAVE_TRACKER_MINER, 1, [Define if Tracker miner library is available])
54         AC_SUBST(TRACKER_MINER_CFLAGS)
55         AC_SUBST(TRACKER_MINER_LIBS)
56         fi
57 ])
58
59 dnl Whether to disable bundled libevent
60 AC_DEFUN([AC_NETATALK_LIBEVENT], [
61     AC_MSG_CHECKING([whether to use bundled libevent])
62     AC_ARG_WITH(
63         libevent,
64         [AS_HELP_STRING([--with-libevent],[whether to use the bundled libevent (default: yes)])],
65         use_bundled_libevent=$withval,
66         use_bundled_libevent=yes
67     )
68     AC_ARG_WITH(
69         libevent-header,
70         [AS_HELP_STRING([--with-libevent-header],[path to libevent header files])],
71         [use_bundled_libevent=no; LIBEVENT_CFLAGS=-I$withval]
72     )
73     AC_ARG_WITH(
74         libevent-lib,
75         [AS_HELP_STRING([--with-libevent-lib],[path to libevent library])],
76         [use_bundled_libevent=no; LIBEVENT_LDFLAGS=-L$withval]
77     )
78     if test x"$LIBEVENT_CFLAGS" = x"-Iyes" -o x"$LIBEVENT_LDFLAGS" = x"-Lyes" ; then
79         AC_MSG_ERROR([--with-libevent requires a path])
80     fi
81     AC_MSG_RESULT([$use_bundled_libevent])
82     AC_CONFIG_SUBDIRS([libevent])
83     AC_SUBST(LIBEVENT_CFLAGS)
84     AC_SUBST(LIBEVENT_LDFLAGS)
85     AM_CONDITIONAL(USE_BUILTIN_LIBEVENT, test x"$use_bundled_libevent" = x"yes")
86 ])
87
88 dnl Filesystem Hierarchy Standard (FHS) compatibility
89 AC_DEFUN([AC_NETATALK_FHS], [
90 AC_MSG_CHECKING([whether to use Filesystem Hierarchy Standard (FHS) compatibility])
91 AC_ARG_ENABLE(fhs,
92         [  --enable-fhs            use Filesystem Hierarchy Standard (FHS) compatibility],[
93         if test "$enableval" = "yes"; then
94                 bindir="/bin"
95                 sbindir="/sbin"
96                 sysconfdir="/etc"
97                 libdir="/lib"
98                 localstatedir="/var"
99                 mandir="/usr/share/man"
100                 uams_path="${libdir}/netatalk"
101                 PKGCONFDIR="${sysconfdir}"
102                 SERVERTEXT="${localstatedir}/netatalk/msg"
103                 use_pam_so=yes
104                 AC_DEFINE(FHS_COMPATIBILITY, 1, [Define if you want compatibily with the FHS])
105                 AC_MSG_RESULT([yes])
106         else
107                 AC_MSG_RESULT([no])
108         fi
109         ],[
110                 AC_MSG_RESULT([no])
111         ]
112 )])
113
114 dnl 64bit platform check
115 AC_DEFUN([AC_NETATALK_64BIT_LIBS], [
116 AC_MSG_CHECKING([whether to check for 64bit libraries])
117 # Test if the compiler is in 64bit mode
118 echo 'int i;' > conftest.$ac_ext
119 atalk_cv_cc_64bit_output=no
120 if AC_TRY_EVAL(ac_compile); then
121     case `/usr/bin/file conftest.$ac_objext` in
122     *"ELF 64"*)
123       atalk_cv_cc_64bit_output=yes
124       ;;
125     esac
126 fi
127 rm -rf conftest*
128
129 case $host_cpu:$atalk_cv_cc_64bit_output in
130 powerpc64:yes | s390x:yes | sparc*:yes | x86_64:yes | i386:yes)
131     case $target_os in
132     solaris2*)
133         AC_MSG_RESULT([yes])
134         atalk_libname="lib/64"
135         ;;
136     *bsd* | dragonfly*)
137         AC_MSG_RESULT([no])
138         atalk_libname="lib"
139         ;;
140     *)
141         AC_MSG_RESULT([yes])
142         atalk_libname="lib64"
143         ;;
144     esac
145     ;;
146 *:*)
147     AC_MSG_RESULT([no])
148     atalk_libname="lib"
149     ;;
150 esac
151 ])
152
153 dnl Check for optional admin group support
154 AC_DEFUN([AC_NETATALK_ADMIN_GROUP], [
155     netatalk_cv_admin_group=yes
156     AC_MSG_CHECKING([for administrative group support])
157     AC_ARG_ENABLE(admin-group,
158             [  --disable-admin-group   disable admin group],[
159             if test x"$enableval" = x"no"; then
160                          AC_DEFINE(ADMIN_GRP, 0, [Define if the admin group should be enabled])
161                          netatalk_cv_admin_group=no
162                          AC_MSG_RESULT([no])
163                 else
164                          AC_DEFINE(ADMIN_GRP, 1, [Define if the admin group should be enabled])
165                          AC_MSG_RESULT([yes])
166             fi],[
167                 AC_DEFINE(ADMIN_GRP, 1, [Define if the admin group should be enabled])
168                 AC_MSG_RESULT([yes])
169         ])
170 ])
171
172 dnl Check for optional cracklib support
173 AC_DEFUN([AC_NETATALK_CRACKLIB], [
174 netatalk_cv_with_cracklib=no
175 AC_ARG_WITH(cracklib,
176         [  --with-cracklib[[=DICT]]  enable/set location of cracklib dictionary [[no]]],[
177         if test "x$withval" != "xno" ; then
178                 cracklib="$withval"
179                 AC_CHECK_LIB(crack, main, [
180                         AC_DEFINE(USE_CRACKLIB, 1, [Define if cracklib should be used])
181                         LIBS="$LIBS -lcrack"
182                         if test "$cracklib" = "yes"; then
183                                 cracklib="/usr/$atalk_libname/cracklib_dict"
184                         fi
185                         AC_DEFINE_UNQUOTED(_PATH_CRACKLIB, "$cracklib",
186                                 [path to cracklib dictionary])
187                         AC_MSG_RESULT([setting cracklib dictionary to $cracklib])
188                         netatalk_cv_with_cracklib=yes
189                         ],[
190                         AC_MSG_ERROR([cracklib not found!])
191                         ]
192                 )
193         fi
194         ]
195 )
196 AC_MSG_CHECKING([for cracklib support])
197 AC_MSG_RESULT([$netatalk_cv_with_cracklib])
198 ])
199
200 dnl Check whether to enable debug code
201 AC_DEFUN([AC_NETATALK_DEBUG], [
202 AC_MSG_CHECKING([whether to enable verbose debug code])
203 AC_ARG_ENABLE(debug,
204         [  --enable-debug          enable verbose debug code],[
205         if test "$enableval" != "no"; then
206                 if test "$enableval" = "yes"; then
207                         AC_DEFINE(DEBUG, 1, [Define if verbose debugging information should be included])
208                 else
209                         AC_DEFINE_UNQUOTED(DEBUG, $enableval, [Define if verbose debugging information should be included])
210                 fi 
211                 AC_MSG_RESULT([yes])
212         else
213                 AC_MSG_RESULT([no])
214         AC_DEFINE(NDEBUG, 1, [Disable assertions])
215         fi
216         ],[
217                 AC_MSG_RESULT([no])
218         AC_DEFINE(NDEBUG, 1, [Disable assertions])
219         ]
220 )
221 ])
222
223 dnl Check whethe to disable tickle SIGALARM stuff, which eases debugging
224 AC_DEFUN([AC_NETATALK_DEBUGGING], [
225 AC_MSG_CHECKING([whether to enable debugging with debuggers])
226 AC_ARG_ENABLE(debugging,
227         [  --enable-debugging      disable SIGALRM timers and DSI tickles (eg for debugging with gdb/dbx/...)],[
228         if test "$enableval" != "no"; then
229                 if test "$enableval" = "yes"; then
230                         AC_DEFINE(DEBUGGING, 1, [Define if you want to disable SIGALRM timers and DSI tickles])
231                 else
232                         AC_DEFINE_UNQUOTED(DEBUGGING, $enableval, [Define if you want to disable SIGALRM timers and DSI tickles])
233                 fi 
234                 AC_MSG_RESULT([yes])
235         else
236                 AC_MSG_RESULT([no])
237         fi
238         ],[
239                 AC_MSG_RESULT([no])
240         ]
241 )
242
243 ])
244
245 dnl Check for optional shadow password support
246 AC_DEFUN([AC_NETATALK_SHADOW], [
247 netatalk_cv_use_shadowpw=no
248 AC_ARG_WITH(shadow,
249         [  --with-shadow           enable shadow password support [[auto]]],
250         [netatalk_cv_use_shadowpw="$withval"],
251         [netatalk_cv_use_shadowpw=auto]
252 )
253
254 if test "x$netatalk_cv_use_shadowpw" != "xno"; then
255     AC_CHECK_HEADER([shadow.h])
256     if test x"$ac_cv_header_shadow_h" = x"yes"; then
257         netatalk_cv_use_shadowpw=yes
258         AC_DEFINE(SHADOWPW, 1, [Define if shadow passwords should be used])
259     else 
260       if test "x$shadowpw" = "xyes"; then
261         AC_MSG_ERROR([shadow support not available])
262       else
263         netatalk_cv_use_shadowpw=no
264       fi
265     fi 
266 fi
267
268 AC_MSG_CHECKING([whether shadow support should be enabled])
269 if test "x$netatalk_cv_use_shadowpw" = "xyes"; then
270         AC_MSG_RESULT([yes])
271 else
272         AC_MSG_RESULT([no])
273 fi
274 ])
275
276 dnl Check for optional valid-shell-check support
277 AC_DEFUN([AC_NETATALK_SHELL_CHECK], [
278 netatalk_cv_use_shellcheck=yes
279 AC_MSG_CHECKING([whether checking for a valid shell should be enabled])
280 AC_ARG_ENABLE(shell-check,
281         [  --disable-shell-check   disable checking for a valid shell],[
282         if test "$enableval" = "no"; then 
283                 AC_DEFINE(DISABLE_SHELLCHECK, 1, [Define if shell check should be disabled])
284                 AC_MSG_RESULT([no])
285                 netatalk_cv_use_shellcheck=no
286         else
287                 AC_MSG_RESULT([yes])
288         fi
289         ],[
290                 AC_MSG_RESULT([yes])
291         ]
292 )
293 ])
294
295 dnl Check for optional sysv initscript install
296 AC_DEFUN([AC_NETATALK_INIT_STYLE], [
297     AC_ARG_WITH(init-style,
298                 [  --with-init-style       use OS specific init config [[redhat-sysv|redhat-systemd|suse-sysv|suse-systemd|gentoo|netbsd|debian|solaris|systemd]]],
299                 init_style="$withval", init_style=none
300     )
301     case "$init_style" in 
302     "redhat")
303             AC_MSG_ERROR([--with-init-style=redhat is obsoleted. Use redhat-sysv or redhat-systemd.])
304         ;;
305     "redhat-sysv")
306             AC_MSG_RESULT([enabling redhat-style sysv initscript support])
307             ;;
308     "redhat-systemd")
309             AC_MSG_RESULT([enabling redhat-style systemd support])
310             ;;
311     "suse")
312             AC_MSG_ERROR([--with-init-style=suse is obsoleted. Use suse-sysv or suse-systemd.])
313         ;;
314     "suse-sysv")
315             AC_MSG_RESULT([enabling suse-style sysv initscript support])
316             ;;
317     "suse-systemd")
318             AC_MSG_RESULT([enabling suse-style systemd support (>=openSUSE12.1)])
319             ;;
320     "gentoo")
321             AC_MSG_RESULT([enabling gentoo-style initscript support])
322         ;;
323     "netbsd")
324             AC_MSG_RESULT([enabling netbsd-style initscript support])
325         ;;
326     "debian")
327             AC_MSG_RESULT([enabling debian-style initscript support])
328         ;;
329     "solaris")
330             AC_MSG_RESULT([enabling solaris-style SMF support])
331         ;;
332     "systemd")
333             AC_MSG_RESULT([enabling general systemd support])
334         ;;
335     "none")
336             AC_MSG_RESULT([disabling init-style support])
337         ;;
338     *)
339             AC_MSG_ERROR([illegal init-style])
340         ;;
341     esac
342     AM_CONDITIONAL(USE_NETBSD, test x$init_style = xnetbsd)
343     AM_CONDITIONAL(USE_REDHAT_SYSV, test x$init_style = xredhat-sysv)
344     AM_CONDITIONAL(USE_SUSE_SYSV, test x$init_style = xsuse-sysv)
345     AM_CONDITIONAL(USE_SOLARIS, test x$init_style = xsolaris)
346     AM_CONDITIONAL(USE_GENTOO, test x$init_style = xgentoo)
347     AM_CONDITIONAL(USE_DEBIAN, test x$init_style = xdebian)
348     AM_CONDITIONAL(USE_SYSTEMD, test x$init_style = xsystemd || test x$init_style = xredhat-systemd || test x$init_style = xsuse-systemd)
349     AM_CONDITIONAL(USE_UNDEF, test x$init_style = xnone)
350
351 ])
352
353 dnl OS specific configuration
354 AC_DEFUN([AC_NETATALK_OS_SPECIFIC], [
355 case "$host_os" in
356         *aix*)                          this_os=aix ;;
357         *freebsd*)                      this_os=freebsd ;;
358         *hpux11*)                       this_os=hpux11 ;;
359         *irix*)                         this_os=irix ;;
360         *linux*)                        this_os=linux ;;
361         *osx*)                          this_os=macosx ;;
362         *darwin*)                       this_os=macosx ;;
363         *netbsd*)                       this_os=netbsd ;;
364         *openbsd*)                      this_os=openbsd ;;
365         *osf*)                          this_os=tru64 ;;
366         *solaris*)                      this_os=solaris ;;
367 esac
368
369 case "$host_cpu" in
370         i386|i486|i586|i686|k7)         this_cpu=x86 ;;
371         alpha)                                          this_cpu=alpha ;;
372         mips)                                           this_cpu=mips ;;
373         powerpc|ppc)                            this_cpu=ppc ;;
374 esac
375
376 dnl --------------------- GNU source
377 case "$this_os" in
378         linux)  AC_DEFINE(_GNU_SOURCE, 1, [Whether to use GNU libc extensions])
379         ;;
380      kfreebsd-gnu) AC_DEFINE(_GNU_SOURCE, 1, [Whether to use GNU libc extensions])
381         ;;
382 esac
383
384 dnl --------------------- operating system specific flags (port from sys/*)
385
386 dnl ----- FreeBSD specific -----
387 if test x"$this_os" = "xfreebsd"; then 
388         AC_MSG_RESULT([ * FreeBSD specific configuration])
389         AC_DEFINE(BSD4_4, 1, [BSD compatiblity macro])
390         AC_DEFINE(FREEBSD, 1, [Define if OS is FreeBSD])
391     AC_DEFINE(OPEN_NOFOLLOW_ERRNO, EMLINK, errno returned by open with O_NOFOLLOW)
392 fi
393
394 dnl ----- GNU/kFreeBSD specific -----
395 if test x"$this_os" = "xkfreebsd-gnu"; then 
396         AC_MSG_RESULT([ * GNU/kFreeBSD specific configuration])
397         AC_DEFINE(BSD4_4, 1, [BSD compatiblity macro])
398         AC_DEFINE(FREEBSD, 1, [Define if OS is FreeBSD])
399     AC_DEFINE(OPEN_NOFOLLOW_ERRNO, EMLINK, errno returned by open with O_NOFOLLOW)
400 fi
401
402 dnl ----- Linux specific -----
403 if test x"$this_os" = "xlinux"; then 
404         AC_MSG_RESULT([ * Linux specific configuration])
405     AC_DEFINE(LINUX, 1, [OS is Linux])  
406         dnl ----- check if we need the quotactl wrapper
407     AC_CHECK_HEADERS(linux/dqblk_xfs.h,,
408                 [AC_CHECK_HEADERS(linux/xqm.h linux/xfs_fs.h)
409                 AC_CHECK_HEADERS(xfs/libxfs.h xfs/xqm.h xfs/xfs_fs.h)]
410         )
411
412
413         dnl ----- as far as I can tell, dbtob always does the wrong thing
414         dnl ----- on every single version of linux I've ever played with.
415         dnl ----- see etc/afpd/quota.c
416         AC_DEFINE(HAVE_BROKEN_DBTOB, 1, [Define if dbtob is broken])
417
418         need_dash_r=no
419 fi
420
421 dnl ----- NetBSD specific -----
422 if test x"$this_os" = "xnetbsd"; then 
423         AC_MSG_RESULT([ * NetBSD specific configuration])
424         AC_DEFINE(BSD4_4, 1, [BSD compatiblity macro])
425         AC_DEFINE(NETBSD, 1, [Define if OS is NetBSD])
426     AC_DEFINE(OPEN_NOFOLLOW_ERRNO, EFTYPE, errno returned by open with O_NOFOLLOW)
427
428         CFLAGS="-I\$(top_srcdir)/sys/netbsd $CFLAGS"
429         need_dash_r=yes 
430
431         dnl ----- NetBSD does not have crypt.h, uses unistd.h -----
432         AC_DEFINE(UAM_DHX, 1, [Define if the DHX UAM modules should be compiled])
433 fi
434
435 dnl ----- OpenBSD specific -----
436 if test x"$this_os" = "xopenbsd"; then 
437         AC_MSG_RESULT([ * OpenBSD specific configuration])
438     AC_DEFINE(BSD4_4, 1, [BSD compatiblity macro])
439         dnl ----- OpenBSD does not have crypt.h, uses unistd.h -----
440         AC_DEFINE(UAM_DHX, 1, [Define if the DHX UAM modules should be compiled])
441 fi
442
443 dnl ----- Solaris specific -----
444 if test x"$this_os" = "xsolaris"; then 
445         AC_MSG_RESULT([ * Solaris specific configuration])
446         AC_DEFINE(__svr4__, 1, [Solaris compatibility macro])
447         AC_DEFINE(_ISOC9X_SOURCE, 1, [Compatibility macro])
448         AC_DEFINE(NO_STRUCT_TM_GMTOFF, 1, [Define if the gmtoff member of struct tm is not available])
449         AC_DEFINE(SOLARIS, 1, [Solaris compatibility macro])
450     AC_DEFINE(_XOPEN_SOURCE, 600, [Solaris compilation environment])
451     AC_DEFINE(__EXTENSIONS__,  1, [Solaris compilation environment])
452         CFLAGS="-I\$(top_srcdir)/sys/generic $CFLAGS"
453         need_dash_r=yes
454         init_style=solaris
455
456         solaris_module=no
457         AC_MSG_CHECKING([if we can build Solaris kernel module])
458         if test -x /usr/ccs/bin/ld && test x"$netatalk_cv_ddp_enabled" = x"yes" ; then
459                 solaris_module=yes
460         fi
461         AC_MSG_RESULT([$solaris_module])
462
463         COMPILE_64BIT_KMODULE=no
464         KCFLAGS=""
465         KLDFLAGS=""
466         COMPILE_KERNEL_GCC=no
467
468         if test "$solaris_module" = "yes"; then
469            dnl Solaris kernel module stuff
470            AC_MSG_CHECKING([if we have to build a 64bit kernel module])
471
472            # check for isainfo, if not found it has to be a 32 bit kernel (<=2.6)       
473            if test -x /usr/bin/isainfo; then
474                 # check for 64 bit platform
475                 if isainfo -kv | grep '^64-bit'; then
476                         COMPILE_64BIT_KMODULE=yes
477                 fi
478            fi
479
480            AC_MSG_RESULT([$COMPILE_64BIT_KMODULE])
481
482            if test "${GCC}" = yes; then
483                 COMPILE_KERNEL_GCC=yes
484                 if test "$COMPILE_64BIT_KMODULE" = yes; then
485                 
486                         AC_MSG_CHECKING([if we can build a 64bit kernel module])
487                         
488                         case `$CC --version 2>/dev/null` in
489                         [[12]].* | 3.0.*)
490                                 COMPILE_64BIT_KMODULE=no
491                                 COMPILE_KERNEL_GCC=no   
492                                 solaris_module=no;;
493                         *)
494                                 # use for 64 bit
495                                 KCFLAGS="-m64"
496                                 #KLDFLAGS="-melf64_sparc"
497                                 KLDFLAGS="-64";;
498                         esac    
499                         
500                         AC_MSG_RESULT([$COMPILE_64BIT_KMODULE])
501                         
502                 else
503                         KCFLAGS=""
504                         KLDFLAGS=""
505                 fi
506                 KCFLAGS="$KCFLAGS -D_KERNEL -Wall -Wstrict-prototypes"
507            else
508                 if test "$COMPILE_64BIT_KMODULE" = yes; then
509                 # use Sun CC (for a 64-bit kernel, uncomment " -xarch=v9 -xregs=no%appl ")
510                         KCFLAGS="-xarch=v9 -xregs=no%appl"
511                         KLDFLAGS="-64"
512                 else
513                         KCFLAGS=""
514                         KLDFLAGS=""
515                 fi
516                 KCFLAGS="-D_KERNEL $KCFLAGS -mno-app-regs -munaligned-doubles -fpcc-struct-return"
517            fi
518
519            AC_CACHE_CHECK([for timeout_id_t],netatalk_cv_HAVE_TIMEOUT_ID_T,[
520            AC_LINK_IFELSE([AC_LANG_PROGRAM([[\
521 #include <sys/stream.h>
522 #include <sys/ddi.h>]], [[\
523 timeout_id_t dummy;
524 ]])],[netatalk_cv_HAVE_TIMEOUT_ID_T=yes],[netatalk_cv_HAVE_TIMEOUT_ID_T=no])])
525
526            AC_DEFINE(HAVE_TIMEOUT_ID_T, test x"$netatalk_cv_HAVE_TIMEOUT_ID" = x"yes", [define for timeout_id_t])
527         fi
528
529         AC_SUBST(COMPILE_KERNEL_GCC)
530         AC_SUBST(COMPILE_64BIT_KMODULE)
531         AC_SUBST(KCFLAGS)
532         AC_SUBST(KLDFLAGS)
533 fi
534
535 dnl Whether to run ldconfig after installing libraries
536 AC_PATH_PROG(NETA_LDCONFIG, ldconfig, , [$PATH$PATH_SEPARATOR/sbin$PATH_SEPARATOR/bin$PATH_SEPARATOR/usr/sbin$PATH_SEPARATOR/usr/bin])
537 echo NETA_LDCONFIG = $NETA_LDCONFIG
538 AM_CONDITIONAL(RUN_LDCONFIG, test x"$this_os" = x"linux" -a x"$NETA_LDCONFIG" != x"")
539 ])
540
541 dnl Check for building PGP UAM module
542 AC_DEFUN([AC_NETATALK_PGP_UAM], [
543 AC_MSG_CHECKING([whether the PGP UAM should be build])
544 AC_ARG_ENABLE(pgp-uam,
545         [  --enable-pgp-uam        enable build of PGP UAM module],[
546         if test "$enableval" = "yes"; then 
547                 if test "x$neta_cv_have_openssl" = "xyes"; then 
548                         AC_DEFINE(UAM_PGP, 1, [Define if the PGP UAM module should be compiled])
549                         compile_pgp=yes
550                         AC_MSG_RESULT([yes])
551                 else
552                         AC_MSG_RESULT([no])
553                 fi
554         fi
555         ],[
556                 AC_MSG_RESULT([no])
557         ]
558 )
559 ])
560
561 dnl Check for building Kerberos V UAM module
562 AC_DEFUN([AC_NETATALK_KRB5_UAM], [
563 netatalk_cv_build_krb5_uam=no
564 AC_ARG_ENABLE(krbV-uam,
565         [  --enable-krbV-uam       enable build of Kerberos V UAM module],
566         [
567                 if test x"$enableval" = x"yes"; then
568                         NETATALK_GSSAPI_CHECK([
569                                 netatalk_cv_build_krb5_uam=yes
570                         ],[
571                                 AC_MSG_ERROR([need GSSAPI to build Kerberos V UAM])
572                         ])
573                 fi
574         ]
575         
576 )
577
578 AC_MSG_CHECKING([whether Kerberos V UAM should be build])
579 if test x"$netatalk_cv_build_krb5_uam" = x"yes"; then
580         AC_MSG_RESULT([yes])
581 else
582         AC_MSG_RESULT([no])
583 fi
584 AM_CONDITIONAL(USE_GSSAPI, test x"$netatalk_cv_build_krb5_uam" = x"yes")
585 ])
586
587 dnl Check if we can directly use Kerberos 5 API, used for reading keytabs
588 dnl and automatically construction DirectoryService names from that, instead
589 dnl of requiring special configuration in afp.conf
590 AC_DEFUN([AC_NETATALK_KERBEROS], [
591 AC_MSG_CHECKING([for Kerberos 5 (necessary for GetSrvrInfo:DirectoryNames support)])
592 AC_ARG_WITH([kerberos],
593     [AS_HELP_STRING([--with-kerberos], [Kerberos 5 support (default=auto)])],
594     [],
595     [with_kerberos=auto])
596 AC_MSG_RESULT($with_kerberos)
597
598 if test x"$with_kerberos" != x"no"; then
599    have_krb5_header="no"
600    AC_CHECK_HEADERS([krb5/krb5.h krb5.h], [have_krb5_header="yes"; break])
601    if test x"$have_krb5_header" = x"no" && test x"$with_kerberos" != x"auto"; then
602       AC_MSG_FAILURE([--with-kerberos was given, but no headers found])
603    fi
604
605    AC_PATH_PROG([KRB5_CONFIG], [krb5-config])
606    AC_MSG_CHECKING([for krb5-config])
607    if test -x "$KRB5_CONFIG"; then
608       AC_MSG_RESULT([$KRB5_CONFIG])
609       KRB5_CFLAGS="`$KRB5_CONFIG --cflags krb5`"
610       KRB5_LIBS="`$KRB5_CONFIG --libs krb5`"
611       AC_SUBST(KRB5_CFLAGS)
612       AC_SUBST(KRB5_LIBS)
613       with_kerberos="yes"
614    else
615       AC_MSG_RESULT([not found])
616       if test x"$with_kerberos" != x"auto"; then
617          AC_MSG_FAILURE([--with-kerberos was given, but krb5-config could not be found])
618       fi
619    fi
620 fi
621
622 if test x"$with_kerberos" = x"yes"; then
623    AC_DEFINE([HAVE_KERBEROS], [1], [Define if Kerberos 5 is available])
624 fi
625
626 dnl Check for krb5_free_unparsed_name and krb5_free_error_message
627 save_CFLAGS="$CFLAGS"
628 save_LIBS="$LIBS"
629 CFLAGS="$KRB5_CFLAGS"
630 LIBS="$KRB5_LIBS"
631 AC_CHECK_FUNCS([krb5_free_unparsed_name krb5_free_error_message])
632 CFLAGS="$save_CFLAGS"
633 LIBS="$save_LIBS"
634 ])
635
636 dnl Check for overwrite the config files or not
637 AC_DEFUN([AC_NETATALK_OVERWRITE_CONFIG], [
638 AC_MSG_CHECKING([whether configuration files should be overwritten])
639 AC_ARG_ENABLE(overwrite,
640         [  --enable-overwrite      overwrite configuration files during installation],
641         [OVERWRITE_CONFIG="${enable_overwrite}"],
642         [OVERWRITE_CONFIG="no"]
643 )
644 AC_MSG_RESULT([$OVERWRITE_CONFIG])
645 AC_SUBST(OVERWRITE_CONFIG)
646 ])
647
648 dnl Check for LDAP support, for client-side ACL visibility
649 AC_DEFUN([AC_NETATALK_LDAP], [
650 AC_MSG_CHECKING(for LDAP (necessary for client-side ACL visibility))
651 AC_ARG_WITH(ldap,
652     [AS_HELP_STRING([--with-ldap],
653         [LDAP support (default=auto)])],
654         netatalk_cv_ldap=$withval,
655         netatalk_cv_ldap=auto
656         )
657 AC_MSG_RESULT($netatalk_cv_ldap)
658
659 save_CFLAGS="$CFLAGS"
660 save_LDFLAGS="$LDFLAGS"
661 save_LIBS="$LIBS"
662 CFLAGS=""
663 LDFLAGS=""
664 LIBS=""
665 LDAP_CFLAGS=""
666 LDAP_LDFLAGS=""
667 LDAP_LIBS=""
668
669 if test x"$netatalk_cv_ldap" != x"no" ; then
670    if test x"$netatalk_cv_ldap" != x"yes" -a x"$netatalk_cv_ldap" != x"auto"; then
671        CFLAGS="-I$netatalk_cv_ldap/include"
672        LDFLAGS="-L$netatalk_cv_ldap/lib"
673    fi
674         AC_CHECK_HEADER([ldap.h], netatalk_cv_ldap=yes,
675         [ if test x"$netatalk_cv_ldap" = x"yes" ; then
676             AC_MSG_ERROR([Missing LDAP headers])
677         fi
678                 netatalk_cv_ldap=no
679         ])
680         AC_CHECK_LIB(ldap, ldap_init, netatalk_cv_ldap=yes,
681         [ if test x"$netatalk_cv_ldap" = x"yes" ; then
682             AC_MSG_ERROR([Missing LDAP library])
683         fi
684                 netatalk_cv_ldap=no
685         ])
686 fi
687
688 if test x"$netatalk_cv_ldap" = x"yes"; then
689     LDAP_CFLAGS="$CFLAGS"
690     LDAP_LDFLAGS="$LDFLAGS"
691     LDAP_LIBS="-lldap"
692         AC_DEFINE(HAVE_LDAP,1,[Whether LDAP is available])
693 fi
694
695 AC_SUBST(LDAP_CFLAGS)
696 AC_SUBST(LDAP_LDFLAGS)
697 AC_SUBST(LDAP_LIBS)
698 CFLAGS="$save_CFLAGS"
699 LDLFLAGS="$save_LDLFLAGS"
700 LIBS="$save_LIBS"
701 ])
702
703 dnl Check for ACL support
704 AC_DEFUN([AC_NETATALK_ACL], [
705 AC_MSG_CHECKING(whether to support ACLs)
706 AC_ARG_WITH(acls,
707     [AS_HELP_STRING([--with-acls],
708         [Include ACL support (default=auto)])],
709     [ case "$withval" in
710       yes|no)
711           with_acl_support="$withval"
712                   ;;
713       *)
714           with_acl_support=auto
715           ;;
716       esac ],
717     [with_acl_support=auto])
718 AC_MSG_RESULT($with_acl_support)
719
720 if test x"$with_acl_support" = x"no"; then
721         AC_MSG_RESULT(Disabling ACL support)
722         AC_DEFINE(HAVE_NO_ACLS,1,[Whether no ACLs support should be built in])
723 else
724     with_acl_support=yes
725 fi
726
727 if test x"$with_acl_support" = x"yes" ; then
728         AC_MSG_NOTICE(checking whether ACL support is available:)
729         case "$host_os" in
730         *sysv5*)
731                 AC_MSG_NOTICE(Using UnixWare ACLs)
732                 AC_DEFINE(HAVE_UNIXWARE_ACLS,1,[Whether UnixWare ACLs are available])
733                 ;;
734         *solaris*)
735                 AC_MSG_NOTICE(Using solaris ACLs)
736                 AC_DEFINE(HAVE_SOLARIS_ACLS,1,[Whether solaris ACLs are available])
737                 ACL_LIBS="$ACL_LIBS -lsec"
738                 ;;
739         *hpux*)
740                 AC_MSG_NOTICE(Using HPUX ACLs)
741                 AC_DEFINE(HAVE_HPUX_ACLS,1,[Whether HPUX ACLs are available])
742                 ;;
743         *irix*)
744                 AC_MSG_NOTICE(Using IRIX ACLs)
745                 AC_DEFINE(HAVE_IRIX_ACLS,1,[Whether IRIX ACLs are available])
746                 ;;
747         *aix*)
748                 AC_MSG_NOTICE(Using AIX ACLs)
749                 AC_DEFINE(HAVE_AIX_ACLS,1,[Whether AIX ACLs are available])
750                 ;;
751         *osf*)
752                 AC_MSG_NOTICE(Using Tru64 ACLs)
753                 AC_DEFINE(HAVE_TRU64_ACLS,1,[Whether Tru64 ACLs are available])
754                 ACL_LIBS="$ACL_LIBS -lpacl"
755                 ;;
756         *darwin*)
757                 AC_MSG_NOTICE(ACLs on Darwin currently not supported)
758                 AC_DEFINE(HAVE_NO_ACLS,1,[Whether no ACLs support is available])
759                 ;;
760         *)
761                 AC_CHECK_LIB(acl,acl_get_file,[ACL_LIBS="$ACL_LIBS -lacl"])
762                 case "$host_os" in
763                 *linux*)
764                         AC_CHECK_LIB(attr,getxattr,[ACL_LIBS="$ACL_LIBS -lattr"])
765                         ;;
766                 esac
767                 AC_CACHE_CHECK([for POSIX ACL support],netatalk_cv_HAVE_POSIX_ACLS,[
768                         acl_LIBS=$LIBS
769                         LIBS="$LIBS $ACL_LIBS"
770                         AC_LINK_IFELSE([AC_LANG_PROGRAM([[
771                                 #include <sys/types.h>
772                                 #include <sys/acl.h>
773                         ]], [[
774                                 acl_t acl;
775                                 int entry_id;
776                                 acl_entry_t *entry_p;
777                                 return acl_get_entry(acl, entry_id, entry_p);
778                         ]])],[netatalk_cv_HAVE_POSIX_ACLS=yes],[netatalk_cv_HAVE_POSIX_ACLS=no
779                 with_acl_support=no])
780                         LIBS=$acl_LIBS
781                 ])
782                 if test x"$netatalk_cv_HAVE_POSIX_ACLS" = x"yes"; then
783                         AC_MSG_NOTICE(Using POSIX ACLs)
784                         AC_DEFINE(HAVE_POSIX_ACLS,1,[Whether POSIX ACLs are available])
785                         AC_CACHE_CHECK([for acl_get_perm_np],netatalk_cv_HAVE_ACL_GET_PERM_NP,[
786                                 acl_LIBS=$LIBS
787                                 LIBS="$LIBS $ACL_LIBS"
788                                 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
789                                         #include <sys/types.h>
790                                         #include <sys/acl.h>
791                                 ]], [[
792                                         acl_permset_t permset_d;
793                                         acl_perm_t perm;
794                                         return acl_get_perm_np(permset_d, perm);
795                                 ]])],[netatalk_cv_HAVE_ACL_GET_PERM_NP=yes],[netatalk_cv_HAVE_ACL_GET_PERM_NP=no])
796                                 LIBS=$acl_LIBS
797                         ])
798                         if test x"$netatalk_cv_HAVE_ACL_GET_PERM_NP" = x"yes"; then
799                                 AC_DEFINE(HAVE_ACL_GET_PERM_NP,1,[Whether acl_get_perm_np() is available])
800                         fi
801
802
803                        AC_CACHE_CHECK([for acl_from_mode], netatalk_cv_HAVE_ACL_FROM_MODE,[
804                                acl_LIBS=$LIBS
805                                LIBS="$LIBS $ACL_LIBS"
806                 AC_CHECK_FUNCS(acl_from_mode,
807                                [netatalk_cv_HAVE_ACL_FROM_MODE=yes],
808                                [netatalk_cv_HAVE_ACL_FROM_MODE=no])
809                                LIBS=$acl_LIBS
810                        ])
811                        if test x"netatalk_cv_HAVE_ACL_FROM_MODE" = x"yes"; then
812                                AC_DEFINE(HAVE_ACL_FROM_MODE,1,[Whether acl_from_mode() is available])
813                        fi
814
815                 else
816                         AC_MSG_NOTICE(ACL support is not avaliable)
817                         AC_DEFINE(HAVE_NO_ACLS,1,[Whether no ACLs support is available])
818                 fi
819                 ;;
820     esac
821 fi
822
823 if test x"$with_acl_support" = x"yes" ; then
824    AC_CHECK_HEADERS([acl/libacl.h])
825     AC_DEFINE(HAVE_ACLS,1,[Whether ACLs support is available])
826     AC_SUBST(ACL_LIBS)
827 fi
828 ])
829
830 dnl Check for Extended Attributes support
831 AC_DEFUN([AC_NETATALK_EXTENDED_ATTRIBUTES], [
832 neta_cv_eas="ad"
833 neta_cv_eas_sys_found=no
834 neta_cv_eas_sys_not_found=no
835
836 AC_CHECK_HEADERS(sys/attributes.h attr/xattr.h sys/xattr.h sys/extattr.h sys/uio.h sys/ea.h)
837
838 case "$this_os" in
839
840   *osf*)
841         AC_SEARCH_LIBS(getproplist, [proplist])
842         AC_CHECK_FUNCS([getproplist fgetproplist setproplist fsetproplist],
843                    [neta_cv_eas_sys_found=yes],
844                    [neta_cv_eas_sys_not_found=yes])
845         AC_CHECK_FUNCS([delproplist fdelproplist add_proplist_entry get_proplist_entry],,
846                    [neta_cv_eas_sys_not_found=yes])
847         AC_CHECK_FUNCS([sizeof_proplist_entry],,
848                    [neta_cv_eas_sys_not_found=yes])
849   ;;
850
851   *solaris*)
852         AC_CHECK_FUNCS([attropen],
853                    [neta_cv_eas_sys_found=yes; AC_DEFINE(HAVE_EAFD, 1, [extattr API has full fledged fds for EAs])],
854                    [neta_cv_eas_sys_not_found=yes])
855   ;;
856
857   'freebsd')
858     AC_CHECK_FUNCS([extattr_delete_fd extattr_delete_file extattr_delete_link],
859                    [neta_cv_eas_sys_found=yes],
860                    [neta_cv_eas_sys_not_found=yes])
861     AC_CHECK_FUNCS([extattr_get_fd extattr_get_file extattr_get_link],,
862                    [neta_cv_eas_sys_not_found=yes])
863     AC_CHECK_FUNCS([extattr_list_fd extattr_list_file extattr_list_link],,
864                    [neta_cv_eas_sys_not_found=yes])
865     AC_CHECK_FUNCS([extattr_set_fd extattr_set_file extattr_set_link],,
866                    [neta_cv_eas_sys_not_found=yes])
867   ;;
868
869   *freebsd4* | *dragonfly* )
870     AC_DEFINE(BROKEN_EXTATTR, 1, [Does extattr API work])
871   ;;
872
873   *)
874         AC_SEARCH_LIBS(getxattr, [attr])
875
876     if test "x$neta_cv_eas_sys_found" != "xyes" ; then
877        AC_CHECK_FUNCS([getxattr lgetxattr fgetxattr listxattr llistxattr],
878                       [neta_cv_eas_sys_found=yes],
879                       [neta_cv_eas_sys_not_found=yes])
880            AC_CHECK_FUNCS([flistxattr removexattr lremovexattr fremovexattr],,
881                       [neta_cv_eas_sys_not_found=yes])
882            AC_CHECK_FUNCS([setxattr lsetxattr fsetxattr],,
883                       [neta_cv_eas_sys_not_found=yes])
884     fi
885
886     if test "x$neta_cv_eas_sys_found" != "xyes" ; then
887            AC_CHECK_FUNCS([getea fgetea lgetea listea flistea llistea],
888                       [neta_cv_eas_sys_found=yes],
889                       [neta_cv_eas_sys_not_found=yes])
890            AC_CHECK_FUNCS([removeea fremoveea lremoveea setea fsetea lsetea],,
891                       [neta_cv_eas_sys_not_found=yes])
892     fi
893
894     if test "x$neta_cv_eas_sys_found" != "xyes" ; then
895            AC_CHECK_FUNCS([attr_get attr_list attr_set attr_remove],,
896                       [neta_cv_eas_sys_not_found=yes])
897        AC_CHECK_FUNCS([attr_getf attr_listf attr_setf attr_removef],,
898                       [neta_cv_eas_sys_not_found=yes])
899     fi
900   ;;
901 esac
902
903 # Do xattr functions take additional options like on Darwin?
904 if test x"$ac_cv_func_getxattr" = x"yes" ; then
905         AC_CACHE_CHECK([whether xattr interface takes additional options], smb_attr_cv_xattr_add_opt, [
906                 old_LIBS=$LIBS
907                 LIBS="$LIBS $ACL_LIBS"
908                 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
909                         #include <sys/types.h>
910                         #if HAVE_ATTR_XATTR_H
911                         #include <attr/xattr.h>
912                         #elif HAVE_SYS_XATTR_H
913                         #include <sys/xattr.h>
914                         #endif
915                 ]], [[
916                         getxattr(0, 0, 0, 0, 0, 0);
917                 ]])],[smb_attr_cv_xattr_add_opt=yes],[smb_attr_cv_xattr_add_opt=no;LIBS=$old_LIBS])
918         ])
919         if test x"$smb_attr_cv_xattr_add_opt" = x"yes"; then
920                 AC_DEFINE(XATTR_ADD_OPT, 1, [xattr functions have additional options])
921         fi
922 fi
923
924 if test "x$neta_cv_eas_sys_found" = "xyes" ; then
925    if test "x$neta_cv_eas_sys_not_found" != "xyes" ; then
926       neta_cv_eas="$neta_cv_eas | sys"
927    fi
928 fi
929 AC_DEFINE_UNQUOTED(EA_MODULES,["$neta_cv_eas"],[Available Extended Attributes modules])
930 ])
931
932 dnl Check for libsmbsharemodes from Samba for Samba/Netatalk access/deny/share modes interop
933 dnl Defines "neta_cv_have_smbshmd" to "yes" or "no"
934 dnl AC_SUBST's "SMB_SHAREMODES_CFLAGS" and "SMB_SHAREMODES_LDFLAGS"
935 dnl AM_CONDITIONAL's "USE_SMB_SHAREMODES"
936 AC_DEFUN([AC_NETATALK_SMB_SHAREMODES], [
937     neta_cv_have_smbshmd=no
938     AC_ARG_WITH(smbsharemodes-lib,
939                 [  --with-smbsharemodes-lib=PATH        PATH to libsmbsharemodes lib from Samba],
940                 [SMB_SHAREMODES_LDFLAGS="-L$withval -lsmbsharemodes"]
941     )
942     AC_ARG_WITH(smbsharemodes-include,
943                 [  --with-smbsharemodes-include=PATH    PATH to libsmbsharemodes header from Samba],
944                 [SMB_SHAREMODES_CFLAGS="-I$withval"]
945     )
946     AC_ARG_WITH(smbsharemodes,
947                 [AS_HELP_STRING([--with-smbsharemodes],[Samba interop (default is yes)])],
948                 [use_smbsharemodes=$withval],
949                 [use_smbsharemodes=yes]
950     )
951
952     if test x"$use_smbsharemodes" = x"yes" ; then
953         AC_MSG_CHECKING([whether to enable Samba/Netatalk access/deny/share-modes interop])
954
955         saved_CFLAGS="$CFLAGS"
956         saved_LDFLAGS="$LDFLAGS"
957         CFLAGS="$SMB_SHAREMODES_CFLAGS $CFLAGS"
958         LDFLAGS="$SMB_SHAREMODES_LDFLAGS $LDFLAGS"
959
960         AC_LINK_IFELSE(
961             [#include <unistd.h>
962              #include <stdio.h>
963              #include <sys/time.h>
964              #include <time.h>
965              #include <stdint.h>
966              /* From messages.h */
967              struct server_id {
968                  pid_t pid;
969              };
970              #include "smb_share_modes.h"
971              int main(void) { (void)smb_share_mode_db_open(""); return 0;}],
972             [neta_cv_have_smbshmd=yes]
973         )
974
975         AC_MSG_RESULT($neta_cv_have_smbshmd)
976         AC_SUBST(SMB_SHAREMODES_CFLAGS, [$SMB_SHAREMODES_CFLAGS])
977         AC_SUBST(SMB_SHAREMODES_LDFLAGS, [$SMB_SHAREMODES_LDFLAGS])
978         CFLAGS="$saved_CFLAGS"
979         LDFLAGS="$saved_LDFLAGS"
980     fi
981
982     AM_CONDITIONAL(USE_SMB_SHAREMODES, test x"$neta_cv_have_smbshmd" = x"yes")
983 ])
984
985 dnl ------ Check for sendfile() --------
986 AC_DEFUN([AC_NETATALK_SENDFILE], [
987 netatalk_cv_search_sendfile=yes
988 AC_ARG_ENABLE(sendfile,
989     [  --disable-sendfile       disable sendfile syscall],
990     [if test x"$enableval" = x"no"; then
991             netatalk_cv_search_sendfile=no
992         fi]
993 )
994
995 if test x"$netatalk_cv_search_sendfile" = x"yes"; then
996    case "$host_os" in
997    *linux*)
998         AC_DEFINE(SENDFILE_FLAVOR_LINUX,1,[Whether linux sendfile() API is available])
999         AC_CHECK_FUNC([sendfile], [netatalk_cv_HAVE_SENDFILE=yes])
1000         ;;
1001
1002     *solaris*)
1003         AC_DEFINE(SENDFILE_FLAVOR_SOLARIS, 1, [Solaris sendfile()])
1004         AC_SEARCH_LIBS(sendfile, sendfile)
1005         AC_CHECK_FUNC([sendfile], [netatalk_cv_HAVE_SENDFILE=yes])
1006         AC_CHECK_FUNCS([sendfilev])
1007         ;;
1008
1009     *freebsd*)
1010         AC_DEFINE(SENDFILE_FLAVOR_BSD, 1, [Define if the sendfile() function uses BSD semantics])
1011         AC_CHECK_FUNC([sendfile], [netatalk_cv_HAVE_SENDFILE=yes])
1012         ;;
1013
1014     *)
1015         ;;
1016
1017     esac
1018
1019     if test x"$netatalk_cv_HAVE_SENDFILE" = x"yes"; then
1020         AC_DEFINE(WITH_SENDFILE,1,[Whether sendfile() should be used])
1021     fi
1022 fi
1023 ])
1024
1025 dnl --------------------- Check if realpath() takes NULL
1026 AC_DEFUN([AC_NETATALK_REALPATH], [
1027 AC_CACHE_CHECK([if the realpath function allows a NULL argument],
1028     neta_cv_REALPATH_TAKES_NULL, [
1029         AC_RUN_IFELSE([AC_LANG_SOURCE([[
1030             #include <stdio.h>
1031             #include <limits.h>
1032             #include <signal.h>
1033
1034             void exit_on_core(int ignored) {
1035                  exit(1);
1036             }
1037
1038             main() {
1039                 char *newpath;
1040                 signal(SIGSEGV, exit_on_core);
1041                 newpath = realpath("/tmp", NULL);
1042                 exit((newpath != NULL) ? 0 : 1);
1043             }]])],[neta_cv_REALPATH_TAKES_NULL=yes],[neta_cv_REALPATH_TAKES_NULL=no],[neta_cv_REALPATH_TAKES_NULL=cross
1044         ])
1045     ]
1046 )
1047
1048 if test x"$neta_cv_REALPATH_TAKES_NULL" = x"yes"; then
1049     AC_DEFINE(REALPATH_TAKES_NULL,1,[Whether the realpath function allows NULL])
1050 fi
1051 ])