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