1 dnl unpacking check - this file must exist
2 AC_INIT(include/libxfs.h)
7 # Note: the following environment variables may be set to override the
8 # defaults (to change paths and/or executables, build parameters, etc):
10 # DEBUG OPTIMIZER MAKE CC LD TAR ZIP RPM AWK SED ECHO
11 # LIBTOOL MALLOCLIB DISTRIBUTION PACKAGE_BUILDER
14 DEBUG=${DEBUG:-'-DDEBUG'} # -DNDEBUG
15 OPTIMIZER=${OPTIMIZER:-'-g'} # (-O1 enforced default)
16 MALLOCLIB=${MALLOCLIB:-''} # /usr/lib/libefence.a
22 dnl Optimization options?
23 opt_build="$OPTIMIZER"
26 dnl Alternate malloc library?
27 malloc_lib="$MALLOCLIB"
33 pkg_version=${PKG_MAJOR}.${PKG_MINOR}.${PKG_REVISION}
34 pkg_release=$PKG_BUILD
38 pkg_distribution="SGI XFS"
39 test -z "$DISTRIBUTION" || pkg_distribution="$DISTRIBUTION"
40 AC_SUBST(pkg_distribution)
42 pkg_builder=`id -u -n`@`hostname`
43 test -z "$PACKAGE_BUILDER" || pkg_builder="$PACKAGE_BUILDER"
46 dnl output header with cpp defs HAVE_*, etc
47 AC_CONFIG_HEADER(include/platform_defs.h)
49 dnl check if user wants their own C compiler
50 test -z "$CC" && AC_PROG_CC
54 dnl check if users wants their own make
55 test -z "$MAKE" && AC_PATH_PROG(MAKE, make, /usr/bin/make)
59 dnl check if users wants their own linker
60 test -z "$LD" && AC_PATH_PROG(LD, ld, /usr/bin/ld)
64 dnl check if the tar program is available
65 test -z "$TAR" && AC_PATH_PROG(TAR, tar)
69 dnl check if the gzip program is available
70 test -z "$ZIP" && AC_PATH_PROG(ZIP, gzip, /bin/gzip)
74 dnl check if the rpm program is available
75 test -z "$RPM" && AC_PATH_PROG(RPM, rpm, /bin/rpm)
79 dnl .. and what version is rpm
82 rpm_version=`$RPM --version | awk '{print $NF}' | awk -F. '{print $1}'`
85 dnl At some point in rpm 4.0, rpm can no longer build rpms, and
86 dnl rpmbuild is needed (rpmbuild may go way back; not sure)
87 dnl So, if rpm version >= 4.0, look for rpmbuild. Otherwise build w/ rpm
89 if test $rpm_version -ge 4; then
90 AC_PATH_PROG(RPMBUILD, rpmbuild)
98 dnl check if the msgfmt program is available
99 test -z "$MSGFMT" && AC_CHECK_PROG(MSGFMT, msgfmt, /usr/bin/msgfmt)
103 dnl check if the makedepend program is available
104 test -z "$MAKEDEPEND" && AC_PATH_PROG(MAKEDEPEND, makedepend, /bin/true)
105 makedepend=$MAKEDEPEND
108 dnl check if symbolic links are supported
111 dnl check if user wants their own awk, sed and echo
112 test -z "$AWK" && AC_PATH_PROG(AWK, awk, /bin/awk)
115 test -z "$SED" && AC_PATH_PROG(SED, sed, /bin/sed)
118 test -z "$ECHO" && AC_PATH_PROG(ECHO, echo, /bin/echo)
122 dnl ensure libtool is installed
123 test -z "$LIBTOOL" && AC_PATH_PROG(LIBTOOL, libtool,,/usr/bin)
124 if test "$LIBTOOL" = ""; then
126 echo 'FATAL ERROR: libtool does not seem to be installed.'
127 echo $pkg_name cannot be built without a working libtool installation.
133 dnl libtool to build libraries static only?
134 AC_ARG_ENABLE(shared,
135 [ --enable-shared=[yes/no] Enable use of shared libraries [default=yes]],,
137 AC_SUBST(enable_shared)
139 dnl Checks for UUID header and library.
140 AC_CHECK_HEADER(uuid/uuid.h,, [
142 echo 'FATAL ERROR: could not find a valid UUID header.'
143 echo 'Install either the e2fsprogs-devel (rpm) or the uuid-dev (deb) package.'
146 AC_CHECK_LIB(uuid, uuid_generate,, [
148 echo 'FATAL ERROR: could not find a valid UUID library.'
149 echo 'Install either the e2fsprogs-devel (rpm) or the uuid-dev (deb) package.'
153 dnl Caution - using libuuid shared adds an additional runtime dependency,
154 dnl but the rpm spec file and debian control file do _not_ enforce this.
155 dnl We want to keep our runtime dependencies to an absolute minimum for
156 dnl this particular package, but the option is there.
158 AC_ARG_ENABLE(shared-uuid,
159 [ --enable-shared-uuid=[yes/no] Link shared libuuid [default=no].],
160 libuuid="/usr/lib/libuuid.a"
161 if test "$enable_shared_uuid" = yes; then
164 libuuid="/usr/lib/libuuid.a")
167 dnl Check if we have a type for the pointer's size integer (__psint_t)
168 AC_MSG_CHECKING([for __psint_t ])
171 #include <sys/types.h>
177 ], AC_DEFINE(HAVE___PSINT_T) AC_MSG_RESULT(yes) , AC_MSG_RESULT(no))
179 dnl Check if we have a type for the pointer's size unsigned (__psunsigned_t)
180 AC_MSG_CHECKING([for __psunsigned_t ])
183 #include <sys/types.h>
188 __psunsigned_t psuint;
189 ], AC_DEFINE(HAVE___PSUNSIGNED_T) AC_MSG_RESULT(yes) , AC_MSG_RESULT(no))
192 if test "$cross_compiling" = yes -a "$ac_cv_sizeof_long" = ""; then
193 AC_MSG_WARN([Cross compiling; assuming 32bit long and 32bit pointers])
195 AC_CHECK_SIZEOF(long, 4)
196 AC_CHECK_SIZEOF(char *, 4)
197 test $ac_cv_sizeof_long -eq 4 && AC_DEFINE(HAVE_32BIT_LONG)
198 test $ac_cv_sizeof_long -eq 8 && AC_DEFINE(HAVE_64BIT_LONG)
199 test $ac_cv_sizeof_char_p -eq 4 && AC_DEFINE(HAVE_32BIT_PTR)
200 test $ac_cv_sizeof_char_p -eq 8 && AC_DEFINE(HAVE_64BIT_PTR)
202 dnl man pages (source)
203 dnl also check if man page source is gzipped
204 dnl (usually on Debian, but not Redhat pre-7.0)
205 have_zipped_manpages=false
206 for d in ${prefix}/share/man ${prefix}/man ; do
207 if test -f $d/man1/man.1.gz
209 have_zipped_manpages=true
213 AC_SUBST(have_zipped_manpages)
215 dnl build definitions for use in Makefiles
216 AC_OUTPUT(include/builddefs)