]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blame - configure.in
Merge whitespace changes over
[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
NS
168if test $enable_readline = yes; then
169 libreadline="-lreadline -lncurses"
170else
171 libreadline=""
172fi
e246ba5f
NS
173AC_SUBST(libreadline)
174AC_SUBST(enable_readline)
175
93d9f139
NS
176dnl will we be making use of gettext?
177AC_ARG_ENABLE(gettext,
dfc13ce1 178[ --enable-gettext=[yes/no] Enable alternate language support [default=yes]],,
93d9f139
NS
179 enable_gettext=yes)
180AC_SUBST(enable_gettext)
181
182dnl check if the msgfmt, msgmerge, xgettext programs are available
183if 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
206fi
207
639231be
NS
208dnl Checks for UUID header and library.
209AC_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
215AC_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 222dnl
93d9f139 223dnl Caution: using libuuid shared adds an additional runtime dependency,
655782c8
NS
224dnl but the rpm spec file and debian control file do _not_ enforce this.
225dnl We want to keep our runtime dependencies to an absolute minimum for
226dnl this particular package, but the option is there.
227dnl
228AC_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 235AC_SUBST(libuuid)
fc49813f 236
fc49813f
NS
237dnl Check if we have a type for the pointer's size integer (__psint_t)
238AC_MSG_CHECKING([for __psint_t ])
239AC_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
249dnl Check if we have a type for the pointer's size unsigned (__psunsigned_t)
250AC_MSG_CHECKING([for __psunsigned_t ])
251AC_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 261dnl Check type sizes
dfc13ce1 262if 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])
264fi
265AC_CHECK_SIZEOF(long, 4)
266AC_CHECK_SIZEOF(char *, 4)
dfc13ce1
NS
267if test $ac_cv_sizeof_long -eq 4; then
268 AC_DEFINE(HAVE_32BIT_LONG)
269fi
270if test $ac_cv_sizeof_long -eq 8; then
271 AC_DEFINE(HAVE_64BIT_LONG)
272fi
273if test $ac_cv_sizeof_char_p -eq 4; then
274 AC_DEFINE(HAVE_32BIT_PTR)
275fi
276if test $ac_cv_sizeof_char_p -eq 8; then
277 AC_DEFINE(HAVE_64BIT_PTR)
278fi
fc49813f 279
fc49813f
NS
280dnl man pages (source)
281dnl also check if man page source is gzipped
282dnl (usually on Debian, but not Redhat pre-7.0)
283have_zipped_manpages=false
284for 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
289done
fc49813f
NS
290AC_SUBST(have_zipped_manpages)
291
6c6508ec
NS
292dnl build definitions for use in Makefiles
293AC_OUTPUT(include/builddefs)