]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - configure.in
Merge whitespace changes over
[thirdparty/xfsprogs-dev.git] / configure.in
1 dnl unpacking check - this file must exist
2 AC_INIT(include/libxfs.h)
3 AC_CONFIG_HEADER(include/platform_defs.h)
4
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 #
12 # DEBUG OPTIMIZER MALLOCLIB
13 # PLATFORM DISTRIBUTION INSTALL_USER INSTALL_GROUP
14 # MAKE CC LD TAR ZIP AWK SED ECHO RPM LIBTOOL
15 # MSGFMT MSGMERGE XGETTEXT
16 #
17
18 DEBUG=${DEBUG:-'-DDEBUG'} # -DNDEBUG
19 OPTIMIZER=${OPTIMIZER:-'-O1 -g'} # some gcc's miscompile at -O2
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
35 . ./VERSION
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
42 pkg_platform=`uname -s`
43 pkg_distribution="Generic $pkg_platform"
44 pkg_platform=`echo $pkg_platform | tr 'A-Z' 'a-z' | sed -e 's/irix64/irix/'`
45 test -z "$PLATFORM" || pkg_platform="$PLATFORM"
46 test -z "$DISTRIBUTION" || pkg_distribution="$DISTRIBUTION"
47 AC_SUBST(pkg_distribution)
48 AC_SUBST(pkg_platform)
49
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)
57
58 dnl check if user wants their own C compiler
59 if test -z "$CC"; then
60 AC_PROG_CC
61 fi
62 cc=$CC
63 AC_SUBST(cc)
64
65 dnl check if users wants their own make
66 if test -z "$MAKE"; then
67 AC_PATH_PROG(MAKE, make, /usr/bin/make)
68 fi
69 make=$MAKE
70 AC_SUBST(make)
71
72 dnl check if users wants their own linker
73 if test -z "$LD"; then
74 AC_PATH_PROG(LD, ld, /usr/bin/ld)
75 fi
76 ld=$LD
77 AC_SUBST(ld)
78
79 dnl check if the tar program is available
80 if test -z "$TAR"; then
81 AC_PATH_PROG(TAR, tar, /bin/tar)
82 fi
83 tar=$TAR
84 AC_SUBST(tar)
85
86 dnl check if the gzip program is available
87 if test -z "$ZIP"; then
88 AC_PATH_PROG(ZIP, gzip, /bin/gzip)
89 fi
90 zip=$ZIP
91 AC_SUBST(zip)
92
93 dnl check if the makedepend program is available
94 if test -z "$MAKEDEPEND"; then
95 AC_PATH_PROG(MAKEDEPEND, makedepend, /bin/true)
96 fi
97 makedepend=$MAKEDEPEND
98 AC_SUBST(makedepend)
99
100 dnl check if the rpm program is available
101 if test -z "$RPM"; then
102 AC_PATH_PROG(RPM, rpm, /bin/rpm)
103 fi
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
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
123 AC_SUBST(rpmbuild)
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
129 if test -z "$AWK"; then
130 AC_PATH_PROG(AWK, awk, /bin/awk)
131 fi
132 awk=$AWK
133 AC_SUBST(awk)
134 if test -z "$SED"; then
135 AC_PATH_PROG(SED, sed, /bin/sed)
136 fi
137 sed=$SED
138 AC_SUBST(sed)
139 if test -z "$ECHO"; then
140 AC_PATH_PROG(ECHO, echo, /bin/echo)
141 fi
142 echo=$ECHO
143 AC_SUBST(echo)
144
145 dnl ensure libtool is installed
146 if test -z "$LIBTOOL"; then
147 AC_PATH_PROG(LIBTOOL, libtool,,/usr/bin)
148 fi
149 if test -z "$LIBTOOL"; then
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?
159 AC_ARG_ENABLE(shared,
160 [ --enable-shared=[yes/no] Enable use of shared libraries [default=yes]],,
161 enable_shared=yes)
162 AC_SUBST(enable_shared)
163
164 dnl will we be making use of readline?
165 AC_ARG_ENABLE(readline,
166 [ --enable-readline=[yes/no] Enable readline command editing [default=no]],,
167 enable_readline=no)
168 if test $enable_readline = yes; then
169 libreadline="-lreadline -lncurses"
170 else
171 libreadline=""
172 fi
173 AC_SUBST(libreadline)
174 AC_SUBST(enable_readline)
175
176 dnl will we be making use of gettext?
177 AC_ARG_ENABLE(gettext,
178 [ --enable-gettext=[yes/no] Enable alternate language support [default=yes]],,
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
184 if test -z "$MSGFMT"; then
185 AC_CHECK_PROG(MSGFMT, msgfmt, /usr/bin/msgfmt)
186 fi
187 msgfmt=$MSGFMT
188 AC_SUBST(msgfmt)
189 if test -z "$MSGMERGE"; then
190 AC_CHECK_PROG(MSGMERGE, msgmerge, /usr/bin/msgmerge)
191 fi
192 msgmerge=$MSGMERGE
193 AC_SUBST(msgmerge)
194 if test -z "$XGETTEXT"; then
195 AC_CHECK_PROG(XGETTEXT, xgettext, /usr/bin/xgettext)
196 fi
197 xgettext=$XGETTEXT
198 AC_SUBST(xgettext)
199
200 if test -z "$XGETTEXT"; then
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
208 dnl Checks for UUID header and library.
209 AC_CHECK_HEADER(uuid/uuid.h,, [
210 echo
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.'
213 exit 1
214 ])
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 ])
221
222 dnl
223 dnl Caution: using libuuid shared adds an additional runtime dependency,
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,
229 [ --enable-shared-uuid=[yes/no] Link shared libuuid [default=no].],
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")
235 AC_SUBST(libuuid)
236
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(
240 [
241 #include <sys/types.h>
242 #include <stdlib.h>
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(
252 [
253 #include <sys/types.h>
254 #include <stdlib.h>
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
261 dnl Check type sizes
262 if test "$cross_compiling" = yes -a -z "$ac_cv_sizeof_long"; then
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)
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
279
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
285 if test -f $d/man1/man.1.gz; then
286 have_zipped_manpages=true
287 break
288 fi
289 done
290 AC_SUBST(have_zipped_manpages)
291
292 dnl build definitions for use in Makefiles
293 AC_OUTPUT(include/builddefs)