]>
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 NS |
12 | # DEBUG OPTIMIZER MALLOCLIB |
13 | # PLATFORM DISTRIBUTION BUILDER | |
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" | |
44 | pkg_platform=`echo $pkg_platform | tr 'A-Z' 'a-z'` | |
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 | |
caca5fe8 | 50 | pkg_builder=`id -u -n`@`hostname` |
9440d84d | 51 | test -z "$BUILDER" || pkg_builder="$BUILDER" |
fc49813f NS |
52 | AC_SUBST(pkg_builder) |
53 | ||
fc49813f NS |
54 | dnl check if user wants their own C compiler |
55 | test -z "$CC" && AC_PROG_CC | |
56 | cc=$CC | |
57 | AC_SUBST(cc) | |
58 | ||
59 | dnl check if users wants their own make | |
60 | test -z "$MAKE" && AC_PATH_PROG(MAKE, make, /usr/bin/make) | |
61 | make=$MAKE | |
62 | AC_SUBST(make) | |
63 | ||
64 | dnl check if users wants their own linker | |
65 | test -z "$LD" && AC_PATH_PROG(LD, ld, /usr/bin/ld) | |
66 | ld=$LD | |
67 | AC_SUBST(ld) | |
68 | ||
69 | dnl check if the tar program is available | |
70 | test -z "$TAR" && AC_PATH_PROG(TAR, tar) | |
71 | tar=$TAR | |
72 | AC_SUBST(tar) | |
73 | ||
74 | dnl check if the gzip program is available | |
75 | test -z "$ZIP" && AC_PATH_PROG(ZIP, gzip, /bin/gzip) | |
76 | zip=$ZIP | |
77 | AC_SUBST(zip) | |
78 | ||
9440d84d NS |
79 | dnl check if the makedepend program is available |
80 | test -z "$MAKEDEPEND" && AC_PATH_PROG(MAKEDEPEND, makedepend, /bin/true) | |
81 | makedepend=$MAKEDEPEND | |
82 | AC_SUBST(makedepend) | |
83 | ||
fc49813f NS |
84 | dnl check if the rpm program is available |
85 | test -z "$RPM" && AC_PATH_PROG(RPM, rpm, /bin/rpm) | |
86 | rpm=$RPM | |
87 | AC_SUBST(rpm) | |
88 | ||
89 | dnl .. and what version is rpm | |
90 | rpm_version=0 | |
91 | test -x $RPM && \ | |
92 | rpm_version=`$RPM --version | awk '{print $NF}' | awk -F. '{print $1}'` | |
93 | AC_SUBST(rpm_version) | |
94 | ||
41a1923d ES |
95 | dnl At some point in rpm 4.0, rpm can no longer build rpms, and |
96 | dnl rpmbuild is needed (rpmbuild may go way back; not sure) | |
97 | dnl So, if rpm version >= 4.0, look for rpmbuild. Otherwise build w/ rpm | |
98 | ||
99 | if test $rpm_version -ge 4; then | |
100 | AC_PATH_PROG(RPMBUILD, rpmbuild) | |
101 | rpmbuild=$RPMBUILD | |
102 | else | |
103 | rpmbuild=$RPM | |
104 | fi | |
41a1923d | 105 | AC_SUBST(rpmbuild) |
fc49813f NS |
106 | |
107 | dnl check if symbolic links are supported | |
108 | AC_PROG_LN_S | |
109 | ||
110 | dnl check if user wants their own awk, sed and echo | |
111 | test -z "$AWK" && AC_PATH_PROG(AWK, awk, /bin/awk) | |
112 | awk=$AWK | |
113 | AC_SUBST(awk) | |
114 | test -z "$SED" && AC_PATH_PROG(SED, sed, /bin/sed) | |
115 | sed=$SED | |
116 | AC_SUBST(sed) | |
117 | test -z "$ECHO" && AC_PATH_PROG(ECHO, echo, /bin/echo) | |
118 | echo=$ECHO | |
119 | AC_SUBST(echo) | |
120 | ||
9440d84d NS |
121 | dnl check if the msgfmt program is available |
122 | test -z "$MSGFMT" && AC_CHECK_PROG(MSGFMT, msgfmt, /usr/bin/msgfmt) | |
123 | msgfmt=$MSGFMT | |
124 | AC_SUBST(msgfmt) | |
125 | ||
126 | dnl check if the msgmerge program is available | |
127 | test -z "$MSGMERGE" && AC_CHECK_PROG(MSGMERGE, msgmerge, /usr/bin/msgmerge) | |
128 | msgmerge=$MSGMERGE | |
129 | AC_SUBST(msgmerge) | |
130 | ||
131 | dnl ensure xgettext is installed | |
132 | test -z "$XGETTEXT" && AC_CHECK_PROG(XGETTEXT, xgettext, /usr/bin/xgettext) | |
133 | if test "$XGETTEXT" = ""; then | |
134 | echo | |
135 | echo 'FATAL ERROR: xgettext does not seem to be installed.' | |
136 | echo $pkg_name cannot be built without a working gettext installation. | |
137 | exit 1 | |
138 | fi | |
139 | xgettext=$XGETTEXT | |
140 | AC_SUBST(xgettext) | |
141 | ||
d5dca43b | 142 | dnl ensure libtool is installed |
540594e9 | 143 | test -z "$LIBTOOL" && AC_PATH_PROG(LIBTOOL, libtool,,/usr/bin) |
d5dca43b NS |
144 | if test "$LIBTOOL" = ""; then |
145 | echo | |
146 | echo 'FATAL ERROR: libtool does not seem to be installed.' | |
147 | echo $pkg_name cannot be built without a working libtool installation. | |
148 | exit 1 | |
149 | fi | |
150 | libtool=$LIBTOOL | |
151 | AC_SUBST(libtool) | |
152 | ||
153 | dnl libtool to build libraries static only? | |
534b0bfd | 154 | AC_ARG_ENABLE(shared, |
6c6508ec | 155 | [ --enable-shared=[yes/no] Enable use of shared libraries [default=yes]],, |
d5dca43b NS |
156 | enable_shared=yes) |
157 | AC_SUBST(enable_shared) | |
158 | ||
9440d84d NS |
159 | dnl will we be making use of gettext? |
160 | AC_ARG_ENABLE(gettext, | |
161 | [ --enable-gettext=[yes/no] Enable alternate language support [default=yes]],, | |
162 | enable_gettext=yes) | |
9440d84d NS |
163 | AC_SUBST(enable_gettext) |
164 | ||
e246ba5f NS |
165 | dnl will we be making use of readline? |
166 | AC_ARG_ENABLE(readline, | |
167 | [ --enable-readline=[yes/no] Enable readline command editing [default=no]],, | |
168 | enable_readline=no) | |
15530608 | 169 | libreadline="-lreadline -lncurses" |
e246ba5f NS |
170 | AC_SUBST(libreadline) |
171 | AC_SUBST(enable_readline) | |
172 | ||
639231be NS |
173 | dnl Checks for UUID header and library. |
174 | AC_CHECK_HEADER(uuid/uuid.h,, [ | |
fc49813f | 175 | echo |
639231be NS |
176 | echo 'FATAL ERROR: could not find a valid UUID header.' |
177 | echo 'Install either the e2fsprogs-devel (rpm) or the uuid-dev (deb) package.' | |
fc49813f NS |
178 | exit 1 |
179 | ]) | |
639231be NS |
180 | AC_CHECK_LIB(uuid, uuid_generate,, [ |
181 | echo | |
182 | echo 'FATAL ERROR: could not find a valid UUID library.' | |
183 | echo 'Install either the e2fsprogs-devel (rpm) or the uuid-dev (deb) package.' | |
184 | exit 1 | |
185 | ]) | |
9440d84d | 186 | |
655782c8 NS |
187 | dnl |
188 | dnl Caution - using libuuid shared adds an additional runtime dependency, | |
189 | dnl but the rpm spec file and debian control file do _not_ enforce this. | |
190 | dnl We want to keep our runtime dependencies to an absolute minimum for | |
191 | dnl this particular package, but the option is there. | |
192 | dnl | |
193 | AC_ARG_ENABLE(shared-uuid, | |
194 | [ --enable-shared-uuid=[yes/no] Link shared libuuid [default=no].], | |
195 | libuuid="/usr/lib/libuuid.a" | |
196 | if test "$enable_shared_uuid" = yes; then | |
197 | libuuid="-luuid" | |
198 | fi, | |
199 | libuuid="/usr/lib/libuuid.a") | |
639231be | 200 | AC_SUBST(libuuid) |
fc49813f | 201 | |
fc49813f NS |
202 | dnl Check if we have a type for the pointer's size integer (__psint_t) |
203 | AC_MSG_CHECKING([for __psint_t ]) | |
204 | AC_TRY_COMPILE( | |
205 | [ | |
206 | #include <sys/types.h> | |
207 | #include <stdlib.h> | |
208 | #include <stddef.h> | |
209 | ], | |
210 | [ | |
211 | __psint_t psint; | |
212 | ], AC_DEFINE(HAVE___PSINT_T) AC_MSG_RESULT(yes) , AC_MSG_RESULT(no)) | |
213 | ||
214 | dnl Check if we have a type for the pointer's size unsigned (__psunsigned_t) | |
215 | AC_MSG_CHECKING([for __psunsigned_t ]) | |
216 | AC_TRY_COMPILE( | |
217 | [ | |
218 | #include <sys/types.h> | |
219 | #include <stdlib.h> | |
220 | #include <stddef.h> | |
221 | ], | |
222 | [ | |
223 | __psunsigned_t psuint; | |
224 | ], AC_DEFINE(HAVE___PSUNSIGNED_T) AC_MSG_RESULT(yes) , AC_MSG_RESULT(no)) | |
225 | ||
caca5fe8 NS |
226 | dnl Check type sizes |
227 | if test "$cross_compiling" = yes -a "$ac_cv_sizeof_long" = ""; then | |
228 | AC_MSG_WARN([Cross compiling; assuming 32bit long and 32bit pointers]) | |
229 | fi | |
230 | AC_CHECK_SIZEOF(long, 4) | |
231 | AC_CHECK_SIZEOF(char *, 4) | |
232 | test $ac_cv_sizeof_long -eq 4 && AC_DEFINE(HAVE_32BIT_LONG) | |
233 | test $ac_cv_sizeof_long -eq 8 && AC_DEFINE(HAVE_64BIT_LONG) | |
234 | test $ac_cv_sizeof_char_p -eq 4 && AC_DEFINE(HAVE_32BIT_PTR) | |
235 | test $ac_cv_sizeof_char_p -eq 8 && AC_DEFINE(HAVE_64BIT_PTR) | |
fc49813f | 236 | |
fc49813f NS |
237 | dnl man pages (source) |
238 | dnl also check if man page source is gzipped | |
239 | dnl (usually on Debian, but not Redhat pre-7.0) | |
240 | have_zipped_manpages=false | |
241 | for d in ${prefix}/share/man ${prefix}/man ; do | |
242 | if test -f $d/man1/man.1.gz | |
243 | then | |
fc49813f NS |
244 | have_zipped_manpages=true |
245 | break | |
246 | fi | |
247 | done | |
fc49813f NS |
248 | AC_SUBST(have_zipped_manpages) |
249 | ||
6c6508ec NS |
250 | dnl build definitions for use in Makefiles |
251 | AC_OUTPUT(include/builddefs) |