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