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