]>
Commit | Line | Data |
---|---|---|
fc49813f NS |
1 | dnl unpacking check - this file must exist |
2 | AC_INIT(include/libxfs.h) | |
9440d84d NS |
3 | AC_CONFIG_HEADER(include/platform_defs.h) |
4 | ||
fc49813f NS |
5 | pkg_name="xfsprogs" |
6 | AC_SUBST(pkg_name) | |
7 | ||
8 | # | |
9 | # Note: the following environment variables may be set to override the | |
10 | # defaults (to change paths and/or executables, build parameters, etc): | |
11 | # | |
9440d84d | 12 | # DEBUG OPTIMIZER MALLOCLIB |
93d9f139 | 13 | # PLATFORM DISTRIBUTION INSTALL_USER INSTALL_GROUP |
9440d84d NS |
14 | # MAKE CC LD TAR ZIP AWK SED ECHO RPM LIBTOOL |
15 | # MSGFMT MSGMERGE XGETTEXT | |
fc49813f NS |
16 | # |
17 | ||
18 | DEBUG=${DEBUG:-'-DDEBUG'} # -DNDEBUG | |
9440d84d | 19 | OPTIMIZER=${OPTIMIZER:-'-O1 -g'} # some gcc's miscompile at -O2 |
fc49813f NS |
20 | MALLOCLIB=${MALLOCLIB:-''} # /usr/lib/libefence.a |
21 | ||
22 | dnl Debug build? | |
23 | debug_build="$DEBUG" | |
24 | AC_SUBST(debug_build) | |
25 | ||
26 | dnl Optimization options? | |
27 | opt_build="$OPTIMIZER" | |
28 | AC_SUBST(opt_build) | |
29 | ||
30 | dnl Alternate malloc library? | |
31 | malloc_lib="$MALLOCLIB" | |
32 | AC_SUBST(malloc_lib) | |
33 | ||
34 | dnl Set version | |
132c4946 | 35 | . ./VERSION |
fc49813f NS |
36 | |
37 | pkg_version=${PKG_MAJOR}.${PKG_MINOR}.${PKG_REVISION} | |
38 | pkg_release=$PKG_BUILD | |
39 | AC_SUBST(pkg_version) | |
40 | AC_SUBST(pkg_release) | |
41 | ||
9440d84d NS |
42 | pkg_platform=`uname -s` |
43 | pkg_distribution="Generic $pkg_platform" | |
93d9f139 | 44 | pkg_platform=`echo $pkg_platform | tr 'A-Z' 'a-z' | sed -e 's/irix64/irix/'` |
9440d84d | 45 | test -z "$PLATFORM" || pkg_platform="$PLATFORM" |
fc49813f NS |
46 | test -z "$DISTRIBUTION" || pkg_distribution="$DISTRIBUTION" |
47 | AC_SUBST(pkg_distribution) | |
9440d84d | 48 | AC_SUBST(pkg_platform) |
fc49813f | 49 | |
93d9f139 NS |
50 | pkg_user=root |
51 | test -z "$INSTALL_USER" || pkg_user="$INSTALL_USER" | |
52 | AC_SUBST(pkg_user) | |
53 | ||
54 | pkg_group=root | |
55 | test -z "$INSTALL_GROUP" || pkg_group="$INSTALL_GROUP" | |
56 | AC_SUBST(pkg_group) | |
fc49813f | 57 | |
fc49813f | 58 | dnl check if user wants their own C compiler |
dfc13ce1 NS |
59 | if test -z "$CC"; then |
60 | AC_PROG_CC | |
61 | fi | |
fc49813f NS |
62 | cc=$CC |
63 | AC_SUBST(cc) | |
64 | ||
65 | dnl check if users wants their own make | |
887651bd NS |
66 | if test -z "$MAKE"; then |
67 | AC_PATH_PROG(MAKE, make, /usr/bin/make) | |
68 | fi | |
fc49813f NS |
69 | make=$MAKE |
70 | AC_SUBST(make) | |
71 | ||
72 | dnl check if users wants their own linker | |
887651bd NS |
73 | if test -z "$LD"; then |
74 | AC_PATH_PROG(LD, ld, /usr/bin/ld) | |
75 | fi | |
fc49813f NS |
76 | ld=$LD |
77 | AC_SUBST(ld) | |
78 | ||
79 | dnl check if the tar program is available | |
887651bd NS |
80 | if test -z "$TAR"; then |
81 | AC_PATH_PROG(TAR, tar, /bin/tar) | |
82 | fi | |
fc49813f NS |
83 | tar=$TAR |
84 | AC_SUBST(tar) | |
85 | ||
86 | dnl check if the gzip program is available | |
887651bd NS |
87 | if test -z "$ZIP"; then |
88 | AC_PATH_PROG(ZIP, gzip, /bin/gzip) | |
89 | fi | |
fc49813f NS |
90 | zip=$ZIP |
91 | AC_SUBST(zip) | |
92 | ||
9440d84d | 93 | dnl check if the makedepend program is available |
887651bd NS |
94 | if test -z "$MAKEDEPEND"; then |
95 | AC_PATH_PROG(MAKEDEPEND, makedepend, /bin/true) | |
96 | fi | |
9440d84d NS |
97 | makedepend=$MAKEDEPEND |
98 | AC_SUBST(makedepend) | |
99 | ||
fc49813f | 100 | dnl check if the rpm program is available |
887651bd NS |
101 | if test -z "$RPM"; then |
102 | AC_PATH_PROG(RPM, rpm, /bin/rpm) | |
103 | fi | |
fc49813f NS |
104 | rpm=$RPM |
105 | AC_SUBST(rpm) | |
106 | ||
107 | dnl .. and what version is rpm | |
108 | rpm_version=0 | |
109 | test -x $RPM && \ | |
110 | rpm_version=`$RPM --version | awk '{print $NF}' | awk -F. '{print $1}'` | |
111 | AC_SUBST(rpm_version) | |
112 | ||
41a1923d ES |
113 | dnl At some point in rpm 4.0, rpm can no longer build rpms, and |
114 | dnl rpmbuild is needed (rpmbuild may go way back; not sure) | |
115 | dnl So, if rpm version >= 4.0, look for rpmbuild. Otherwise build w/ rpm | |
116 | ||
117 | if test $rpm_version -ge 4; then | |
118 | AC_PATH_PROG(RPMBUILD, rpmbuild) | |
119 | rpmbuild=$RPMBUILD | |
120 | else | |
121 | rpmbuild=$RPM | |
122 | fi | |
41a1923d | 123 | AC_SUBST(rpmbuild) |
fc49813f NS |
124 | |
125 | dnl check if symbolic links are supported | |
126 | AC_PROG_LN_S | |
127 | ||
128 | dnl check if user wants their own awk, sed and echo | |
887651bd NS |
129 | if test -z "$AWK"; then |
130 | AC_PATH_PROG(AWK, awk, /bin/awk) | |
131 | fi | |
fc49813f NS |
132 | awk=$AWK |
133 | AC_SUBST(awk) | |
887651bd NS |
134 | if test -z "$SED"; then |
135 | AC_PATH_PROG(SED, sed, /bin/sed) | |
136 | fi | |
fc49813f NS |
137 | sed=$SED |
138 | AC_SUBST(sed) | |
887651bd NS |
139 | if test -z "$ECHO"; then |
140 | AC_PATH_PROG(ECHO, echo, /bin/echo) | |
141 | fi | |
fc49813f NS |
142 | echo=$ECHO |
143 | AC_SUBST(echo) | |
144 | ||
d5dca43b | 145 | dnl ensure libtool is installed |
887651bd NS |
146 | if test -z "$LIBTOOL"; then |
147 | AC_PATH_PROG(LIBTOOL, libtool,,/usr/bin) | |
148 | fi | |
dfc13ce1 | 149 | if test -z "$LIBTOOL"; then |
d5dca43b NS |
150 | echo |
151 | echo 'FATAL ERROR: libtool does not seem to be installed.' | |
152 | echo $pkg_name cannot be built without a working libtool installation. | |
153 | exit 1 | |
154 | fi | |
155 | libtool=$LIBTOOL | |
156 | AC_SUBST(libtool) | |
157 | ||
158 | dnl libtool to build libraries static only? | |
534b0bfd | 159 | AC_ARG_ENABLE(shared, |
dfc13ce1 | 160 | [ --enable-shared=[yes/no] Enable use of shared libraries [default=yes]],, |
d5dca43b NS |
161 | enable_shared=yes) |
162 | AC_SUBST(enable_shared) | |
163 | ||
e246ba5f NS |
164 | dnl will we be making use of readline? |
165 | AC_ARG_ENABLE(readline, | |
dfc13ce1 | 166 | [ --enable-readline=[yes/no] Enable readline command editing [default=no]],, |
e246ba5f | 167 | enable_readline=no) |
93d9f139 NS |
168 | if test $enable_readline = yes; then |
169 | libreadline="-lreadline -lncurses" | |
170 | else | |
171 | libreadline="" | |
172 | fi | |
e246ba5f NS |
173 | AC_SUBST(libreadline) |
174 | AC_SUBST(enable_readline) | |
175 | ||
93d9f139 NS |
176 | dnl will we be making use of gettext? |
177 | AC_ARG_ENABLE(gettext, | |
dfc13ce1 | 178 | [ --enable-gettext=[yes/no] Enable alternate language support [default=yes]],, |
93d9f139 NS |
179 | enable_gettext=yes) |
180 | AC_SUBST(enable_gettext) | |
181 | ||
182 | dnl check if the msgfmt, msgmerge, xgettext programs are available | |
183 | if test "$enable_gettext" = yes; then | |
887651bd NS |
184 | if test -z "$MSGFMT"; then |
185 | AC_CHECK_PROG(MSGFMT, msgfmt, /usr/bin/msgfmt) | |
186 | fi | |
93d9f139 NS |
187 | msgfmt=$MSGFMT |
188 | AC_SUBST(msgfmt) | |
887651bd NS |
189 | if test -z "$MSGMERGE"; then |
190 | AC_CHECK_PROG(MSGMERGE, msgmerge, /usr/bin/msgmerge) | |
191 | fi | |
93d9f139 NS |
192 | msgmerge=$MSGMERGE |
193 | AC_SUBST(msgmerge) | |
887651bd NS |
194 | if test -z "$XGETTEXT"; then |
195 | AC_CHECK_PROG(XGETTEXT, xgettext, /usr/bin/xgettext) | |
196 | fi | |
93d9f139 NS |
197 | xgettext=$XGETTEXT |
198 | AC_SUBST(xgettext) | |
199 | ||
dfc13ce1 | 200 | if test -z "$XGETTEXT"; then |
93d9f139 NS |
201 | echo |
202 | echo 'FATAL ERROR: xgettext does not seem to be installed.' | |
203 | echo $pkg_name cannot be built without a working gettext installation. | |
204 | exit 1 | |
205 | fi | |
206 | fi | |
207 | ||
639231be NS |
208 | dnl Checks for UUID header and library. |
209 | AC_CHECK_HEADER(uuid/uuid.h,, [ | |
fc49813f | 210 | echo |
639231be NS |
211 | echo 'FATAL ERROR: could not find a valid UUID header.' |
212 | echo 'Install either the e2fsprogs-devel (rpm) or the uuid-dev (deb) package.' | |
fc49813f NS |
213 | exit 1 |
214 | ]) | |
639231be NS |
215 | AC_CHECK_LIB(uuid, uuid_generate,, [ |
216 | echo | |
217 | echo 'FATAL ERROR: could not find a valid UUID library.' | |
218 | echo 'Install either the e2fsprogs-devel (rpm) or the uuid-dev (deb) package.' | |
219 | exit 1 | |
220 | ]) | |
9440d84d | 221 | |
655782c8 | 222 | dnl |
93d9f139 | 223 | dnl Caution: using libuuid shared adds an additional runtime dependency, |
655782c8 NS |
224 | dnl but the rpm spec file and debian control file do _not_ enforce this. |
225 | dnl We want to keep our runtime dependencies to an absolute minimum for | |
226 | dnl this particular package, but the option is there. | |
227 | dnl | |
228 | AC_ARG_ENABLE(shared-uuid, | |
dfc13ce1 | 229 | [ --enable-shared-uuid=[yes/no] Link shared libuuid [default=no].], |
655782c8 NS |
230 | libuuid="/usr/lib/libuuid.a" |
231 | if test "$enable_shared_uuid" = yes; then | |
232 | libuuid="-luuid" | |
233 | fi, | |
234 | libuuid="/usr/lib/libuuid.a") | |
639231be | 235 | AC_SUBST(libuuid) |
fc49813f | 236 | |
fc49813f NS |
237 | dnl Check if we have a type for the pointer's size integer (__psint_t) |
238 | AC_MSG_CHECKING([for __psint_t ]) | |
239 | AC_TRY_COMPILE( | |
dfc130f3 | 240 | [ |
fc49813f | 241 | #include <sys/types.h> |
dfc130f3 | 242 | #include <stdlib.h> |
fc49813f NS |
243 | #include <stddef.h> |
244 | ], | |
245 | [ | |
246 | __psint_t psint; | |
247 | ], AC_DEFINE(HAVE___PSINT_T) AC_MSG_RESULT(yes) , AC_MSG_RESULT(no)) | |
248 | ||
249 | dnl Check if we have a type for the pointer's size unsigned (__psunsigned_t) | |
250 | AC_MSG_CHECKING([for __psunsigned_t ]) | |
251 | AC_TRY_COMPILE( | |
dfc130f3 | 252 | [ |
fc49813f | 253 | #include <sys/types.h> |
dfc130f3 | 254 | #include <stdlib.h> |
fc49813f NS |
255 | #include <stddef.h> |
256 | ], | |
257 | [ | |
258 | __psunsigned_t psuint; | |
259 | ], AC_DEFINE(HAVE___PSUNSIGNED_T) AC_MSG_RESULT(yes) , AC_MSG_RESULT(no)) | |
260 | ||
caca5fe8 | 261 | dnl Check type sizes |
dfc13ce1 | 262 | if test "$cross_compiling" = yes -a -z "$ac_cv_sizeof_long"; then |
caca5fe8 NS |
263 | AC_MSG_WARN([Cross compiling; assuming 32bit long and 32bit pointers]) |
264 | fi | |
265 | AC_CHECK_SIZEOF(long, 4) | |
266 | AC_CHECK_SIZEOF(char *, 4) | |
dfc13ce1 NS |
267 | if test $ac_cv_sizeof_long -eq 4; then |
268 | AC_DEFINE(HAVE_32BIT_LONG) | |
269 | fi | |
270 | if test $ac_cv_sizeof_long -eq 8; then | |
271 | AC_DEFINE(HAVE_64BIT_LONG) | |
272 | fi | |
273 | if test $ac_cv_sizeof_char_p -eq 4; then | |
274 | AC_DEFINE(HAVE_32BIT_PTR) | |
275 | fi | |
276 | if test $ac_cv_sizeof_char_p -eq 8; then | |
277 | AC_DEFINE(HAVE_64BIT_PTR) | |
278 | fi | |
fc49813f | 279 | |
fc49813f NS |
280 | dnl man pages (source) |
281 | dnl also check if man page source is gzipped | |
282 | dnl (usually on Debian, but not Redhat pre-7.0) | |
283 | have_zipped_manpages=false | |
284 | for d in ${prefix}/share/man ${prefix}/man ; do | |
887651bd | 285 | if test -f $d/man1/man.1.gz; then |
fc49813f NS |
286 | have_zipped_manpages=true |
287 | break | |
288 | fi | |
289 | done | |
fc49813f NS |
290 | AC_SUBST(have_zipped_manpages) |
291 | ||
6c6508ec NS |
292 | dnl build definitions for use in Makefiles |
293 | AC_OUTPUT(include/builddefs) |