]> git.proxmox.com Git - mirror_zfs-debian.git/blob - configure.ac
First step of META build system cleanup
[mirror_zfs-debian.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 ZFS_AC_META
36 AC_CONFIG_AUX_DIR([config])
37 AC_CANONICAL_SYSTEM
38 AM_INIT_AUTOMAKE([$META_NAME], [$META_VERSION])
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 # Check for needed userspace bits
61 AC_CHECK_HEADERS(sys/types.h sys/byteorder.h sys/isa_defs.h \
62 sys/systeminfo.h sys/u8_textprep.h libdiskmgt.h)
63
64 AC_CHECK_FUNCS(strlcat strlcpy strnlen issetugid setmntent getexecname)
65
66 AC_CHECK_LIB([diskmgt], [libdiskmgt_error],
67 [AC_DEFINE([HAVE_LIBDISKMGT], 1,
68 [Define to 1 if 'libdiskmgt' library available])])
69
70 AC_CHECK_LIB([efi], [efi_alloc_and_init],
71 [AC_DEFINE([HAVE_LIBEFI], 1,
72 [Define to 1 if 'libefi' library available])])
73
74 AC_CHECK_LIB([share], [sa_init],
75 [AC_DEFINE([HAVE_LIBSHARE], 1,
76 [Define to 1 if 'libshare' library available])])
77
78 AC_EGREP_HEADER(ioctl, unistd.h,
79 [AC_DEFINE([HAVE_IOCTL_IN_UNISTD_H], 1,
80 [Define to 1 if ioctl() is defined in <unistd.h> header file])])
81
82 AC_EGREP_HEADER(ioctl, sys/ioctl.h,
83 [AC_DEFINE([HAVE_IOCTL_IN_SYS_IOCTL_H], 1,
84 [Define to 1 if ioctl() is defined in <sys/ioctl.h> header file])])
85
86 AC_EGREP_HEADER(ioctl, stropts.h,
87 [AC_DEFINE([HAVE_IOCTL_IN_STROPTS_H], 1,
88 [Define to 1 if ioctl() is defined in <stropts.h> header file])])
89
90 AC_EGREP_HEADER(strcmp, strings.h,
91 [AC_DEFINE([HAVE_STRCMP_IN_STRINGS_H], 1,
92 [Define to 1 if strcmpl() is defined in <strings.h> header file])])
93
94 AC_EGREP_HEADER(sysinfo, sys/systeminfo.h,
95 [AC_DEFINE([HAVE_SYSINFO_IN_SYS_SYSTEMINFO_H], 1,
96 [Define to 1 if sysinfo() is defined in <sys/systeminfo.h> header file])])
97
98 #AC_DEFINE([HAVE_ZVOL], 1, ["Define to 1 to include ZVOL support"])
99 #AC_DEFINE([HAVE_ZPL], 1, ["Define to 1 to include ZPL support"])
100 #AC_DEFINE([WANT_FAKE_IOCTL], 1, ["Define to 1 to use fake ioctl() support"])
101 #AC_DEFINE([HAVE_DM_INUSE_SWAP], 1, ["None"])
102 #AC_DEFINE([HAVE_UNICODE], 1, ["None"])
103 #AC_DEFINE([HAVE_INTTYPES], 1, [Define to 1 if unint16 defined in <sys/types.h> header file])
104
105 # Add "V=1" to KERNELMAKE_PARAMS to enable verbose module build
106 KERNELMAKE_PARAMS=
107 KERNELCPPFLAGS="$KERNELCPPFLAGS -DHAVE_SPL -D_KERNEL -I$splsrc -I$splsrc/include -I$TOPDIR"
108
109 # Minimally required for pread() functionality an other GNU goodness
110 HOSTCFLAGS="$HOSTCFLAGS -ggdb -O2 -std=c99 -D_GNU_SOURCE -D__EXTENSIONS__ "
111 # Quiet warnings not covered by the gcc-* patches
112 HOSTCFLAGS="$HOSTCFLAGS -Wno-switch -Wno-unused -Wno-missing-braces -Wno-parentheses "
113 HOSTCFLAGS="$HOSTCFLAGS -Wno-uninitialized -fno-strict-aliasing "
114 # Expected defines not covered by zfs_config.h
115 HOSTCFLAGS="$HOSTCFLAGS -DHAVE_SPL -D_POSIX_PTHREAD_SEMANTICS "
116 HOSTCFLAGS="$HOSTCFLAGS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_REENTRANT "
117 HOSTCFLAGS="$HOSTCFLAGS -DTEXT_DOMAIN=\\\"zfs-linux-kernel\\\" "
118 # Expected default include paths additional paths added by Makefiles
119 HOSTCFLAGS="$HOSTCFLAGS -I$TOPDIR "
120
121 if test "$kernelbuild" != "$kernelsrc"; then
122 KERNELMAKE_PARAMS="$KERNELMAKE_PARAMS O=$kernelbuild"
123 fi
124
125 AC_SUBST(KERNELMAKE_PARAMS)
126 AC_SUBST(KERNELCPPFLAGS)
127 AC_SUBST(HOSTCFLAGS)
128
129 AC_CONFIG_FILES([ Makefile
130 config/Makefile
131 doc/Makefile
132 scripts/Makefile
133 zfs/Makefile
134 zfs/lib/libudmu/include/Makefile
135 zfs/lib/libudmu/Makefile
136 zfs/lib/Makefile
137 zfs/lib/libnvpair/include/sys/Makefile
138 zfs/lib/libnvpair/include/Makefile
139 zfs/lib/libnvpair/Makefile
140 zfs/lib/libsolcompat/sparc64/Makefile
141 zfs/lib/libsolcompat/Makefile
142 zfs/lib/libsolcompat/include/tsol/Makefile
143 zfs/lib/libsolcompat/include/sparc64/sys/Makefile
144 zfs/lib/libsolcompat/include/sparc64/Makefile
145 zfs/lib/libsolcompat/include/rpc/Makefile
146 zfs/lib/libsolcompat/include/i386/sys/Makefile
147 zfs/lib/libsolcompat/include/i386/Makefile
148 zfs/lib/libsolcompat/include/ia32/sys/Makefile
149 zfs/lib/libsolcompat/include/ia32/Makefile
150 zfs/lib/libsolcompat/include/amd64/sys/Makefile
151 zfs/lib/libsolcompat/include/amd64/Makefile
152 zfs/lib/libsolcompat/include/sys/sysevent/Makefile
153 zfs/lib/libsolcompat/include/sys/fm/Makefile
154 zfs/lib/libsolcompat/include/sys/Makefile
155 zfs/lib/libsolcompat/include/Makefile
156 zfs/lib/libsolcompat/i386/Makefile
157 zfs/lib/libsolcompat/amd64/Makefile
158 zfs/lib/libavl/include/sys/Makefile
159 zfs/lib/libavl/include/Makefile
160 zfs/lib/libavl/Makefile
161 zfs/lib/libuutil/include/Makefile
162 zfs/lib/libuutil/Makefile
163 zfs/lib/libzfs/include/Makefile
164 zfs/lib/libzfs/Makefile
165 zfs/lib/libumem/include/Makefile
166 zfs/lib/libumem/Makefile
167 zfs/lib/libumem/sys/Makefile
168 zfs/lib/libzcommon/include/Makefile
169 zfs/lib/libzcommon/include/sys/fm/fs/Makefile
170 zfs/lib/libzcommon/include/sys/fm/Makefile
171 zfs/lib/libzcommon/include/sys/Makefile
172 zfs/lib/libzcommon/include/sys/fs/Makefile
173 zfs/lib/libzcommon/Makefile
174 zfs/lib/libzpool/Makefile
175 zfs/lib/libport/include/sys/Makefile
176 zfs/lib/libport/include/Makefile
177 zfs/lib/libport/Makefile
178 zfs/lib/libdmu-ctl/include/sys/Makefile
179 zfs/lib/libdmu-ctl/include/Makefile
180 zfs/lib/libdmu-ctl/Makefile
181 zfs/zcmd/ztest/Makefile
182 zfs/zcmd/Makefile
183 zfs/zcmd/zfs/Makefile
184 zfs/zcmd/zdb/Makefile
185 zfs/zcmd/zinject/Makefile
186 zfs/zcmd/zdump/Makefile
187 zfs/zcmd/zpool/Makefile
188 ])
189 AC_OUTPUT
190
191 # HACK: I really, really hate this... but to ensure the kernel build
192 # system compiles C files shared between a library and a kernel module,
193 # we need to ensure each file has a unique make target. To do that
194 # I'm creating symlinks for each shared file at configure time. It
195 # may be possible something better can be done in the Makefile but it
196 # will take some serious investigation and I don't have the time now.
197
198 echo
199 echo "Creating symlinks for additional make targets"
200 ln -s $LIBDIR/libport/u8_textprep.c $LIBDIR/libport/ku8_textprep.c
201 ln -s $LIBDIR/libavl/avl.c $LIBDIR/libavl/kavl.c
202 ln -s $LIBDIR/libavl/avl.c $LIBDIR/libavl/uavl.c
203 ln -s $LIBDIR/libnvpair/nvpair.c $LIBDIR/libnvpair/knvpair.c
204 ln -s $LIBDIR/libnvpair/nvpair.c $LIBDIR/libnvpair/unvpair.c
205 ln -s $LIBDIR/libzcommon/zfs_deleg.c $LIBDIR/libzcommon/kzfs_deleg.c
206 ln -s $LIBDIR/libzcommon/zfs_prop.c $LIBDIR/libzcommon/kzfs_prop.c
207 ln -s $LIBDIR/libzcommon/zprop_common.c $LIBDIR/libzcommon/kzprop_common.c
208 ln -s $LIBDIR/libzcommon/compress.c $LIBDIR/libzcommon/kcompress.c
209 ln -s $LIBDIR/libzcommon/list.c $LIBDIR/libzcommon/klist.c
210 ln -s $LIBDIR/libzcommon/zfs_namecheck.c $LIBDIR/libzcommon/kzfs_namecheck.c
211 ln -s $LIBDIR/libzcommon/zfs_comutil.c $LIBDIR/libzcommon/kzfs_comutil.c
212 ln -s $LIBDIR/libzcommon/zpool_prop.c $LIBDIR/libzcommon/kzpool_prop.c