Imported Upstream version 4.0.31
[platform/upstream/mtools.git] / configure.in
1 dnl Copyright 1996-2003,2005,2006,2008,2009 Alain Knaff.
2 dnl This file is part of mtools.
3 dnl
4 dnl Mtools is free software: you can redistribute it and/or modify
5 dnl it under the terms of the GNU General Public License as published by
6 dnl the Free Software Foundation, either version 3 of the License, or
7 dnl (at your option) any later version.
8 dnl
9 dnl Mtools is distributed in the hope that it will be useful,
10 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
11 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 dnl GNU General Public License for more details.
13 dnl
14 dnl You should have received a copy of the GNU General Public License
15 dnl along with Mtools.  If not, see <http://www.gnu.org/licenses/>.
16 dnl
17 dnl Process this file with autoconf to produce a configure script.
18 AC_INIT(buffer.c)
19
20 AC_CONFIG_HEADER(config.h)
21
22 dnl Checks for compiler
23 AC_PROG_CC
24 dnl AC_PROG_CXX
25 AC_PROG_GCC_TRADITIONAL
26 AC_PROG_INSTALL
27 AC_PROG_LN_S
28
29 AC_PATH_PROG(INSTALL_INFO, install-info, "")
30
31 dnl Check for Systems
32 AC_USE_SYSTEM_EXTENSIONS
33 AC_CANONICAL_SYSTEM
34
35 AC_C_CONST
36 AC_C_INLINE
37
38 dnl Check for configuration options
39 dnl Enable OS/2 extended density format disks
40 AC_ARG_ENABLE(xdf,
41 [  --enable-xdf           support for OS/2 extended density format disks],
42 [if test x$enableval = xyes; then
43   AC_DEFINE([USE_XDF],1,[Define this if you want to use Xdf])
44 fi],AC_DEFINE([USE_XDF],1,[Define this if you want to use Xdf]))
45
46
47 dnl Check for configuration options
48 dnl Enable usage of vold on Solaris
49 AC_ARG_ENABLE(vold,
50 [  --enable-vold          compatibility with Solaris' vold],
51 [if test x$enableval = xyes; then
52   AC_DEFINE([USING_VOLD],1,[Define this if you use mtools together with Solaris' vold])
53 fi])
54
55
56 dnl Check for configuration options
57 dnl Enable usage of vold on Solaris
58 AC_ARG_ENABLE(new-vold,
59 [  --enable-new-vold          compatibility with Solaris' vold, new version],
60 [newVold=x$enableval
61 if test x$enableval = xyes; then
62   AC_DEFINE([USING_NEW_VOLD],1,[Define this if you use mtools together with the new Solaris' vold support])
63 fi])
64
65
66 dnl Check for configuration options
67 dnl Debugging
68 AC_ARG_ENABLE(debug,
69 [  --enable-debug         debugging messages],
70 [if test x$enableval = xyes; then
71   AC_DEFINE([DEBUG],1,[Define for debugging messages])
72 fi])
73
74
75 dnl Check for configuration options
76 dnl Raw terminal code (enabled by default)
77 AC_ARG_ENABLE(raw_term,
78 [  --enable-raw-term      raw terminal (readkey behaviour, default)],
79 [if test x$enableval = xyes; then
80   AC_DEFINE([USE_RAWTERM],1,[Define on non Unix OS'es which don't have the concept of tty's])
81 fi],
82 AC_DEFINE([USE_RAWTERM],1,[Define on non Unix OS'es which don't have the concept of tty's]))
83
84
85 dnl Checks for libraries.
86
87 dnl AC_IRIX_SUN
88 AC_CHECK_LIB(sun, getpwnam)
89 AC_CHECK_LIB(cam, cam_open_device)
90 AC_CHECK_LIB(iconv, iconv)
91
92 dnl Checks for header files.
93 AC_HEADER_STDC
94 AC_HEADER_SYS_WAIT
95 AC_HEADER_STDBOOL
96 AC_CHECK_HEADERS(assert.h getopt.h stdlib.h stdbool.h unistd.h linux/unistd.h \
97 libc.h fcntl.h limits.h sys/file.h sys/ioctl.h sys/time.h strings.h string.h \
98 sys/param.h memory.h malloc.h io.h signal.h sys/signal.h utime.h sgtty.h \
99 sys/floppy.h mntent.h sys/sysmacros.h netinet/in.h netinet/tcp.h assert.h \
100 iconv.h wctype.h wchar.h locale.h xlocale.h linux/fs.h)
101 AC_CHECK_HEADERS(termio.h sys/termio.h, [break])
102 AC_CHECK_HEADERS(termios.h sys/termios.h, [break])
103
104 dnl Check for types
105 AC_SYS_LARGEFILE
106 AC_TYPE_INT8_T
107 AC_TYPE_INT16_T
108 AC_TYPE_INT32_T
109 AC_TYPE_UINT8_T
110 AC_TYPE_UINT16_T
111 AC_TYPE_UINT32_T
112 AC_TYPE_SSIZE_T
113 AC_TYPE_SIZE_T
114 AC_TYPE_OFF_T
115 AC_TYPE_SIGNAL
116 AC_TYPE_UID_T
117
118 AC_CHECK_TYPES(caddr_t)
119 AC_CHECK_SIZEOF(size_t)
120 AC_CHECK_SIZEOF(time_t)
121 AC_CHECK_SIZEOF(long)
122 AC_CHECK_SIZEOF(long long)
123
124 dnl
125 dnl Check to see if llseek() is declared in unistd.h.  On some libc's
126 dnl it is, and on others it isn't..... Thank you glibc developers....
127 dnl
128 dnl Warning!  Use of --enable-gcc-wall may throw off this test.
129 dnl
130 dnl
131 AC_MSG_CHECKING(whether llseek declared in unistd.h)
132 AC_CACHE_VAL(mtools_cv_have_llseek_prototype,
133         AC_TRY_COMPILE(
134 [#include <unistd.h>], [extern int llseek(int);],
135         [mtools_cv_have_llseek_prototype=no],
136         [mtools_cv_have_llseek_prototype=yes]))
137 AC_MSG_RESULT($mtools_cv_have_llseek_prototype)
138 if test "$mtools_cv_have_llseek_prototype" = yes; then
139    AC_DEFINE([HAVE_LLSEEK_PROTOTYPE],1,[Define when you have an LLSEEK prototype])
140 fi
141
142 AC_MSG_CHECKING(whether lseek64 declared in unistd.h)
143 AC_CACHE_VAL(mtools_cv_have_lseek64_prototype,
144         AC_TRY_COMPILE(
145 [
146 #include "sysincludes.h"
147 #include <unistd.h>
148 ], [extern int lseek64(int);],
149         [mtools_cv_have_lseek64_prototype=no],
150         [mtools_cv_have_lseek64_prototype=yes]))
151 AC_MSG_RESULT($mtools_cv_have_lseek64_prototype)
152 if test "$mtools_cv_have_lseek64_prototype" = yes; then
153    AC_DEFINE([HAVE_LSEEK64_PROTOTYPE],1,[Define when you have an LSEEK64 prototype])
154 fi
155
156
157 AC_CHECK_FUNCS(htons)
158
159 dnl Apparently termio before termios is preferred by A/UX, AIX and SCO
160
161 dnl Checks for typedefs, structures, and compiler characteristics.
162 AC_C_CONST
163 AC_C_INLINE
164 AC_TYPE_SIZE_T
165 AC_HEADER_TIME
166 AC_STRUCT_TM
167
168
169 dnl Checks for library functions.
170 AC_TYPE_SIGNAL
171 AC_CHECK_FUNCS(strerror random srandom strchr strrchr lockf flock \
172 strcasecmp strncasecmp strnlen atexit on_exit getpass memmove \
173 strdup strndup strcspn strspn strtoul strtol strtoll strtoi strtoui \
174 memcpy strpbrk memset setenv seteuid setresuid setpgrp \
175 tcsetattr tcflush basename fchdir media_oldaliases llseek lseek64 \
176 snprintf stat64 setlocale toupper_l strncasecmp_l \
177 wcsdup wcscasecmp wcsnlen putwc \
178 getuserid getgroupid \
179 alarm sigaction usleep)
180
181 dnl
182 dnl Check for 64-bit off_t
183 dnl
184 AC_DEFUN(SFS_CHECK_OFF_T_64,
185 [AC_CACHE_CHECK(for 64-bit off_t, sfs_cv_off_t_64,
186 AC_TRY_COMPILE([
187 #include <unistd.h>
188 #include <sys/types.h>
189 ],[
190 switch (0) case 0: case (sizeof (off_t) <= 4):;
191 ], sfs_cv_off_t_64=no, sfs_cv_off_t_64=yes))
192 if test $sfs_cv_off_t_64 = yes; then
193         AC_DEFINE([HAVE_OFF_T_64],1,[Define when the system has a 64 bit off_t type])
194 fi])
195
196
197 dnl ICE_CC_LOFF_T
198 dnl -------------
199 dnl
200 dnl If the CC compiler supports `loff_t' type,  define `HAVE_LOFF_T'.
201 dnl
202 AC_DEFUN(ICE_CC_LOFF_T,
203 [
204 AC_MSG_CHECKING(whether ${CC} supports loff_t type)
205 AC_CACHE_VAL(ice_cv_have_loff_t,
206 [
207 AC_TRY_COMPILE([#include <sys/types.h>],[loff_t a;],
208 ice_cv_have_loff_t=yes,
209 ice_cv_have_loff_t=no)
210 ])
211 AC_MSG_RESULT($ice_cv_have_loff_t)
212 if test "$ice_cv_have_loff_t" = yes; then
213 AC_DEFINE([HAVE_LOFF_T],1,[Define when the compiler supports LOFF_T type])
214 fi
215 ])dnl
216
217
218 dnl ICE_CC_OFFSET_T
219 dnl -------------
220 dnl
221 dnl If the CC compiler supports `offset_t' type,  define `HAVE_OFFSET_T'.
222 dnl
223 AC_DEFUN(ICE_CC_OFFSET_T,
224 [
225 AC_MSG_CHECKING(whether ${CC} supports offset_t type)
226 AC_CACHE_VAL(ice_cv_have_offset_t,
227 [
228 AC_TRY_COMPILE([#include <sys/types.h>],[offset_t a;],
229 ice_cv_have_offset_t=yes,
230 ice_cv_have_offset_t=no)
231 ])
232 AC_MSG_RESULT($ice_cv_have_offset_t)
233 if test "$ice_cv_have_offset_t" = yes; then
234 AC_DEFINE([HAVE_OFFSET_T],1,[Define when the compiler supports OFFSET_T type])
235 fi
236 ])dnl
237
238 dnl ICE_CC_LONG_LONG
239 dnl -------------
240 dnl
241 dnl If the CC compiler supports `long long' type,  define `HAVE_LONG_LONG'.
242 dnl
243 AC_DEFUN(ICE_CC_LONG_LONG,
244 [
245 AC_MSG_CHECKING(whether ${CC} supports long long type)
246 AC_CACHE_VAL(ice_cv_have_long_long,
247 [
248 AC_TRY_COMPILE(,[long long a;],
249 ice_cv_have_long_long=yes,
250 ice_cv_have_long_long=no)
251 ])
252 AC_MSG_RESULT($ice_cv_have_long_long)
253 if test "$ice_cv_have_long_long" = yes; then
254 AC_DEFINE([HAVE_LONG_LONG],1,[Define when the compiler supports LONG_LONG type])
255 fi
256 ])dnl
257
258 dnl ICE_CC_OFF64_T
259 dnl -------------
260 dnl
261 dnl If the CC compiler supports `long long' type,  define `HAVE_OFF64_T'.
262 dnl
263 AC_DEFUN(ICE_CC_OFF64_T,
264 [
265 AC_MSG_CHECKING(whether ${CC} supports off64_t type)
266 AC_CACHE_VAL(ice_cv_have_off64_t,
267 [
268 AC_TRY_COMPILE(,[off64_t a;],
269 ice_cv_have_off64_t=yes,
270 ice_cv_have_off64_t=no)
271 ])
272 AC_MSG_RESULT($ice_cv_have_off64_t)
273 if test "$ice_cv_have_off64_t" = yes; then
274 AC_DEFINE([HAVE_OFF64_T],1,[Define when the compiler supports OFF64_T type])
275 fi
276 ])dnl
277
278
279 SFS_CHECK_OFF_T_64
280 ICE_CC_LOFF_T
281 ICE_CC_OFFSET_T
282 ICE_CC_LONG_LONG
283
284
285 AC_CHECK_FUNCS(utimes utime, [break])
286 AC_CHECK_FUNCS(tzset gettimeofday)
287
288 CF_SYS_ERRLIST
289
290 [
291 host_os0=`echo $host_os | sed 's/-/_/g'`
292 host_os1=`echo $host_os0 | sed 's/\./_/g'`
293 host_os2=`echo $host_os0 | sed 's/^\([^.]*\)\..*$/\1/g'`
294 host_os3=`echo $host_os2 | sed 's/^\([^0-9]*\)[0-9]*$/\1/g'`
295 host_cpu1=`echo $host_cpu | sed 's/\./_/g'`
296 host_vendor1=`echo $host_vendor | sed 's/\./_/g'`
297 HOST_ID="-DCPU_$host_cpu1 -DVENDOR_$host_vendor1 -DOS_$host_os1"
298 if [ $host_os1 != $host_os2 ] ; then
299         HOST_ID="$HOST_ID -DOS_$host_os2"
300 fi
301 if [ $host_os1 != $host_os3 ] && [ $host_os2 != $host_os3 ] ; then
302         HOST_ID="$HOST_ID -DOS_$host_os3"
303 fi
304
305 my_host_os=`echo $host_os1 $host_os2 $host_os3 | sort -u`
306 objs=`echo $srcdir/*.c | sed 's/\.c$/.o/' `
307 if [ "X$GCC" = "Xyes" ] ; then
308     Wall=-Wall
309     if [ "$host_os3" = sunos ] ; then
310             Wall=""
311     fi
312     if [ "$host_os3" = ultrix ] ; then
313             Wall=""
314     fi
315     if [ "$host_os3" = linux ] ; then
316             CFLAGS="$CFLAGS -fno-strength-reduce"
317     fi
318     if [ "$host_os3" = aux ] ; then
319             CFLAGS="$CFLAGS -ZP"
320             MACHDEPLIBS="-lposix -UTIL"
321     fi
322     case "${host}" in
323        arm*-*-linux) CFLAGS="$CFLAGS -mstructure-size-boundary=8";;
324     esac
325     CFLAGS="$CFLAGS $Wall"
326 else
327     if [ $host_os3 = hpux ] ; then
328             CPPFLAGS="$CPPFLAGS -Ae"
329     fi
330
331     if [ $host_os3 = xenix ] ; then
332             CFLAGS="$CFLAGS -M2e"
333     fi
334 fi
335
336 if [ $host_os3 = hpux ] ; then
337             LDFLAGS="$LDFLAGS -z"
338 fi
339
340 if [ $host_os3 = xenix ] ; then
341     LDFLAGS="$LDFLAGS -M2e -i -f 5000"
342 fi
343
344 if [ $host_os2 = sysv4 ] ; then
345     SHLIB="-lc -L/usr/ucblib -lucb"
346 else
347     SHLIB=""
348 fi
349
350 if [ $host_os3 = isc ] ; then
351     CFLAGS="$CFLAGS -D_SYSV3"
352     SHLIB="-lc_s"
353 fi
354
355 if [ $host_os3 = solaris -a x$newVold = xxyes ] ; then
356     SHLIB="$SHLIB -s -lvolmgt"
357 fi
358
359 if [ $host_os3 = nextstep ] ; then
360     CFLAGS="$CFLAGS -DBSD"
361     SHLIB=""
362 fi
363
364 if [ -d /usr/5lib ] ; then
365         extralibdir=-L/usr/5lib
366 fi
367
368 ]
369
370 AC_PATH_X
371 AC_PATH_XTRA
372
373 dnl Floppyd
374 AC_ARG_ENABLE(floppyd,
375 [  --enable-floppyd       floppy daemon support],
376 [if test x$enableval != x; then
377   use_floppyd=$enableval
378 fi])
379
380 AC_CHECK_LIB(socket,main)
381 dnl AC_CHECK_LIB(nsl,getpwnam)
382 AC_CHECK_LIB(bsd,main)
383 AC_CHECK_HEADERS(sys/socket.h arpa/inet.h netdb.h)
384
385 if test X$use_floppyd = X -a X$no_x = X ; then
386     use_floppyd="yes"
387 fi
388
389 if test X$use_floppyd = Xyes; then
390     if test X$no_x = Xyes ; then
391         echo "Floppyd needs X support" >&2
392         echo "To compile without floppyd, use ./configure --disable-floppyd" >&2
393         exit 1
394     fi
395     FLOPPYD="floppyd floppyd_installtest"
396     BINFLOPPYD="\$(DESTDIR)\$(bindir)/floppyd \$(DESTDIR)\$(bindir)/floppyd_installtest"
397     AC_DEFINE([USE_FLOPPYD],1,[Define when you want to include floppyd support])
398     AC_FUNC_SETPGRP
399 else
400     FLOPPYD=
401     BINFLOPPYD=
402 fi
403
404
405 AC_SUBST(FLOPPYD)
406 AC_SUBST(BINFLOPPYD)
407 AC_SUBST(extraincludedir)
408 AC_SUBST(extralibdir)
409 AC_SUBST(MACHDEPLIBS)
410 AC_SUBST(SHLIB)
411 AC_SUBST(host_cpu)
412 AC_SUBST(HOST_ID)
413 AC_OUTPUT(Makefile)