Use config directory, enable maintainer mode
[zfs.git] / configure.ac
1 #
2 # This file is part of the ZFS Linux port.
3 #
4 # Copyright (c) 2008 Lawrence Livermore National Security, LLC.
5 # Produced at Lawrence Livermore National Laboratory
6 # Written by:
7 #         Brian Behlendorf <behlendorf1@llnl.gov>,
8 #         Herb Wartens <wartens2@llnl.gov>,
9 #         Jim Garlick <garlick@llnl.gov>
10 # LLNL-CODE-403049
11 #
12 # CDDL HEADER START
13 #
14 # The contents of this file are subject to the terms of the
15 # Common Development and Distribution License, Version 1.0 only
16 # (the "License").  You may not use this file except in compliance
17 # with the License.
18 #
19 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
20 # or http://www.opensolaris.org/os/licensing.
21 # See the License for the specific language governing permissions
22 # and limitations under the License.
23 #
24 # When distributing Covered Code, include this CDDL HEADER in each
25 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
26 # If applicable, add the following below this CDDL HEADER, with the
27 # fields enclosed by brackets "[]" replaced with your own identifying
28 # information: Portions Copyright [yyyy] [name of copyright owner]
29 #
30 # CDDL HEADER END
31 #
32
33 AC_INIT
34 AC_LANG(C)
35
36 AC_CONFIG_AUX_DIR([config])
37 AC_CANONICAL_SYSTEM
38 AM_INIT_AUTOMAKE(zfs, 0.4.0)
39 AC_CONFIG_HEADERS([zfs_config.h])
40 AM_MAINTAINER_MODE
41
42 AC_PROG_INSTALL
43 AC_PROG_CC
44 AC_PROG_LIBTOOL
45
46 zfsconfig=kernel
47 kernelsrc=
48 kernelbuild=
49 splsrc=
50 splbuild=
51
52 ZFS_AC_CONFIG
53 ZFS_AC_KERNEL
54 ZFS_AC_SPL
55 ZFS_AC_SCRIPT_CONFIG
56 ZFS_AC_LICENSE
57 ZFS_AC_DEBUG
58 ZFS_AC_2ARGS_BIO_END_IO_T
59
60 AC_SUBST(UNAME)
61 AC_SUBST(CONFIG)
62 AC_SUBST(NAME)
63 AC_SUBST(SVNURL)
64 AC_SUBST(BRANCH)
65 AC_SUBST(VERSION)
66 AC_SUBST(RELEASE)
67 AC_SUBST(BRANCHURL)
68 AC_SUBST(TAGURL)
69 AC_SUBST(BUILDURL)
70 AC_SUBST(BUILDDIR)
71
72 # Check for needed userspace bits
73 AC_CHECK_HEADERS(sys/types.h sys/byteorder.h sys/isa_defs.h \
74                  sys/systeminfo.h sys/u8_textprep.h libdiskmgt.h)
75
76 AC_CHECK_FUNCS(strlcat strlcpy strnlen issetugid setmntent getexecname)
77
78 AC_CHECK_LIB([diskmgt], [libdiskmgt_error],
79         [AC_DEFINE([HAVE_LIBDISKMGT], 1,
80         [Define to 1 if 'libdiskmgt' library available])])
81
82 AC_CHECK_LIB([efi], [efi_alloc_and_init],
83         [AC_DEFINE([HAVE_LIBEFI], 1,
84         [Define to 1 if 'libefi' library available])])
85
86 AC_CHECK_LIB([share], [sa_init],
87         [AC_DEFINE([HAVE_LIBSHARE], 1,
88         [Define to 1 if 'libshare' library available])])
89
90 AC_EGREP_HEADER(ioctl, unistd.h,
91         [AC_DEFINE([HAVE_IOCTL_IN_UNISTD_H], 1,
92         [Define to 1 if ioctl() is defined in <unistd.h> header file])])
93
94 AC_EGREP_HEADER(ioctl, sys/ioctl.h,
95         [AC_DEFINE([HAVE_IOCTL_IN_SYS_IOCTL_H], 1,
96         [Define to 1 if ioctl() is defined in <sys/ioctl.h> header file])])
97
98 AC_EGREP_HEADER(ioctl, stropts.h,
99         [AC_DEFINE([HAVE_IOCTL_IN_STROPTS_H], 1,
100         [Define to 1 if ioctl() is defined in <stropts.h> header file])])
101
102 AC_EGREP_HEADER(strcmp, strings.h, 
103         [AC_DEFINE([HAVE_STRCMP_IN_STRINGS_H], 1,
104         [Define to 1 if strcmpl() is defined in <strings.h> header file])])
105
106 AC_EGREP_HEADER(sysinfo, sys/systeminfo.h, 
107         [AC_DEFINE([HAVE_SYSINFO_IN_SYS_SYSTEMINFO_H], 1,
108         [Define to 1 if sysinfo() is defined in <sys/systeminfo.h> header file])])
109
110 #AC_DEFINE([HAVE_ZVOL], 1, ["Define to 1 to include ZVOL support"])
111 #AC_DEFINE([HAVE_ZPL], 1, ["Define to 1 to include ZPL support"])
112 #AC_DEFINE([WANT_FAKE_IOCTL], 1, ["Define to 1 to use fake ioctl() support"])
113 #AC_DEFINE([HAVE_DM_INUSE_SWAP], 1, ["None"])
114 #AC_DEFINE([HAVE_UNICODE], 1, ["None"])
115 #AC_DEFINE([HAVE_INTTYPES], 1, [Define to 1 if unint16 defined in <sys/types.h> header file])
116
117 # Add "V=1" to KERNELMAKE_PARAMS to enable verbose module build
118 KERNELMAKE_PARAMS=
119 KERNELCPPFLAGS="$KERNELCPPFLAGS -DHAVE_SPL -D_KERNEL -I$splsrc -I$splsrc/include -I$TOPDIR"
120
121 # Minimally required for pread() functionality an other GNU goodness
122 HOSTCFLAGS="$HOSTCFLAGS -ggdb -O2 -std=c99 -D_GNU_SOURCE -D__EXTENSIONS__ "
123 # Quiet warnings not covered by the gcc-* patches
124 HOSTCFLAGS="$HOSTCFLAGS -Wno-switch -Wno-unused -Wno-missing-braces -Wno-parentheses "
125 HOSTCFLAGS="$HOSTCFLAGS -Wno-uninitialized -fno-strict-aliasing "
126 # Expected defines not covered by zfs_config.h
127 HOSTCFLAGS="$HOSTCFLAGS -DHAVE_SPL -D_POSIX_PTHREAD_SEMANTICS "
128 HOSTCFLAGS="$HOSTCFLAGS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_REENTRANT "
129 HOSTCFLAGS="$HOSTCFLAGS -DTEXT_DOMAIN=\\\"zfs-linux-kernel\\\" "
130 # Expected default include paths additional paths added by Makefiles
131 HOSTCFLAGS="$HOSTCFLAGS -I$TOPDIR "
132
133 if test "$kernelbuild" != "$kernelsrc"; then
134         KERNELMAKE_PARAMS="$KERNELMAKE_PARAMS O=$kernelbuild"
135 fi
136
137 AC_SUBST(KERNELMAKE_PARAMS)
138 AC_SUBST(KERNELCPPFLAGS)
139 AC_SUBST(HOSTCFLAGS)
140
141 AC_CONFIG_FILES([ Makefile
142                   autoconf/Makefile
143                   config/Makefile
144                   doc/Makefile
145                   scripts/Makefile
146                   zfs/Makefile
147                   zfs/lib/libudmu/include/Makefile
148                   zfs/lib/libudmu/Makefile
149                   zfs/lib/Makefile
150                   zfs/lib/libnvpair/include/sys/Makefile
151                   zfs/lib/libnvpair/include/Makefile
152                   zfs/lib/libnvpair/Makefile
153                   zfs/lib/libsolcompat/sparc64/Makefile
154                   zfs/lib/libsolcompat/Makefile
155                   zfs/lib/libsolcompat/include/tsol/Makefile
156                   zfs/lib/libsolcompat/include/sparc64/sys/Makefile
157                   zfs/lib/libsolcompat/include/sparc64/Makefile
158                   zfs/lib/libsolcompat/include/rpc/Makefile
159                   zfs/lib/libsolcompat/include/i386/sys/Makefile
160                   zfs/lib/libsolcompat/include/i386/Makefile
161                   zfs/lib/libsolcompat/include/ia32/sys/Makefile
162                   zfs/lib/libsolcompat/include/ia32/Makefile
163                   zfs/lib/libsolcompat/include/amd64/sys/Makefile
164                   zfs/lib/libsolcompat/include/amd64/Makefile
165                   zfs/lib/libsolcompat/include/sys/sysevent/Makefile
166                   zfs/lib/libsolcompat/include/sys/fm/Makefile
167                   zfs/lib/libsolcompat/include/sys/Makefile
168                   zfs/lib/libsolcompat/include/Makefile
169                   zfs/lib/libsolcompat/i386/Makefile
170                   zfs/lib/libsolcompat/amd64/Makefile
171                   zfs/lib/libavl/include/sys/Makefile
172                   zfs/lib/libavl/include/Makefile
173                   zfs/lib/libavl/Makefile
174                   zfs/lib/libuutil/include/Makefile
175                   zfs/lib/libuutil/Makefile
176                   zfs/lib/libzfs/include/Makefile
177                   zfs/lib/libzfs/Makefile
178                   zfs/lib/libumem/include/Makefile
179                   zfs/lib/libumem/Makefile
180                   zfs/lib/libumem/sys/Makefile
181                   zfs/lib/libzcommon/include/Makefile
182                   zfs/lib/libzcommon/include/sys/fm/fs/Makefile
183                   zfs/lib/libzcommon/include/sys/fm/Makefile
184                   zfs/lib/libzcommon/include/sys/Makefile
185                   zfs/lib/libzcommon/include/sys/fs/Makefile
186                   zfs/lib/libzcommon/Makefile
187                   zfs/lib/libzpool/Makefile
188                   zfs/lib/libport/include/sys/Makefile
189                   zfs/lib/libport/include/Makefile
190                   zfs/lib/libport/Makefile
191                   zfs/lib/libdmu-ctl/include/sys/Makefile
192                   zfs/lib/libdmu-ctl/include/Makefile
193                   zfs/lib/libdmu-ctl/Makefile
194                   zfs/zcmd/ztest/Makefile
195                   zfs/zcmd/Makefile
196                   zfs/zcmd/zfs/Makefile
197                   zfs/zcmd/zdb/Makefile
198                   zfs/zcmd/zinject/Makefile
199                   zfs/zcmd/zdump/Makefile
200                   zfs/zcmd/zpool/Makefile
201                ])
202 AC_OUTPUT
203
204 # HACK: I really, really hate this...  but to ensure the kernel build 
205 # system compiles C files shared between a library and a kernel module, 
206 # we need to ensure each file has a unique make target.  To do that 
207 # I'm creating symlinks for each shared file at configure time.  It 
208 # may be possible something better can be done in the Makefile but it
209 # will take some serious investigation and I don't have the time now.
210
211 echo
212 echo "Creating symlinks for additional make targets"
213 ln -s $LIBDIR/libport/u8_textprep.c      $LIBDIR/libport/ku8_textprep.c
214 ln -s $LIBDIR/libavl/avl.c               $LIBDIR/libavl/kavl.c
215 ln -s $LIBDIR/libavl/avl.c               $LIBDIR/libavl/uavl.c
216 ln -s $LIBDIR/libnvpair/nvpair.c         $LIBDIR/libnvpair/knvpair.c
217 ln -s $LIBDIR/libnvpair/nvpair.c         $LIBDIR/libnvpair/unvpair.c
218 ln -s $LIBDIR/libzcommon/zfs_deleg.c     $LIBDIR/libzcommon/kzfs_deleg.c
219 ln -s $LIBDIR/libzcommon/zfs_prop.c      $LIBDIR/libzcommon/kzfs_prop.c
220 ln -s $LIBDIR/libzcommon/zprop_common.c  $LIBDIR/libzcommon/kzprop_common.c
221 ln -s $LIBDIR/libzcommon/compress.c      $LIBDIR/libzcommon/kcompress.c
222 ln -s $LIBDIR/libzcommon/list.c          $LIBDIR/libzcommon/klist.c
223 ln -s $LIBDIR/libzcommon/zfs_namecheck.c $LIBDIR/libzcommon/kzfs_namecheck.c
224 ln -s $LIBDIR/libzcommon/zfs_comutil.c   $LIBDIR/libzcommon/kzfs_comutil.c
225 ln -s $LIBDIR/libzcommon/zpool_prop.c    $LIBDIR/libzcommon/kzpool_prop.c