1 dnl Copyright 1996-2003,2005,2006,2008,2009 Alain Knaff.
2 dnl This file is part of mtools.
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.
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.
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/>.
17 dnl Process this file with autoconf to produce a configure script.
20 AC_CONFIG_HEADER(config.h)
22 dnl Checks for compiler
25 AC_PROG_GCC_TRADITIONAL
29 AC_PATH_PROG(INSTALL_INFO, install-info, "")
32 AC_USE_SYSTEM_EXTENSIONS
39 dnl Check for configuration options
40 dnl Enable OS/2 extended density format disks
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]))
48 dnl Check for configuration options
49 dnl Enable usage of vold on Solaris
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])
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],
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])
67 dnl Check for configuration options
70 [ --enable-debug debuging messages],
71 [if test x$enableval = xyes; then
72 AC_DEFINE([DEBUG],1,[Define for debugging messages])
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])
83 AC_DEFINE([USE_RAWTERM],1,[Define on non Unix OS'es which don't have the concept of tty's]))
86 dnl Checks for libraries.
89 AC_CHECK_LIB(sun, getpwnam)
90 AC_CHECK_LIB(cam, cam_open_device)
92 dnl Checks for header files.
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])
105 dnl Check to see if llseek() is declared in unistd.h. On some libc's
106 dnl it is, and on others it isn't..... Thank you glibc developers....
108 dnl Warning! Use of --enable-gcc-wall may throw off this test.
111 AC_MSG_CHECKING(whether llseek declared in unistd.h)
112 AC_CACHE_VAL(mtools_cv_have_llseek_prototype,
114 [#include <unistd.h>], [extern int llseek(int);],
115 [mtools_cv_have_llseek_prototype=no],
116 [mtools_cv_have_llseek_prototype=yes]))
117 AC_MSG_RESULT($mtools_cv_have_llseek_prototype)
118 if test "$mtools_cv_have_llseek_prototype" = yes; then
119 AC_DEFINE([HAVE_LLSEEK_PROTOTYPE],1,[Define when you have an LLSEEK prototype])
122 AC_MSG_CHECKING(whether lseek64 declared in unistd.h)
123 AC_CACHE_VAL(mtools_cv_have_lseek64_prototype,
126 #include "sysincludes.h"
128 ], [extern int lseek64(int);],
129 [mtools_cv_have_lseek64_prototype=no],
130 [mtools_cv_have_lseek64_prototype=yes]))
131 AC_MSG_RESULT($mtools_cv_have_lseek64_prototype)
132 if test "$mtools_cv_have_lseek64_prototype" = yes; then
133 AC_DEFINE([HAVE_LSEEK64_PROTOTYPE],1,[Define when you have an LSEEK64 prototype])
137 AC_CHECK_FUNCS(htons)
139 dnl Apparently termio before termios is preferred by A/UX, AIX and SCO
141 dnl Checks for typedefs, structures, and compiler characteristics.
149 dnl Checks for library functions.
151 AC_CHECK_FUNCS(strerror random srandom strchr strrchr lockf flock \
152 strcasecmp strncasecmp strnlen atexit on_exit getpass memmove \
153 strdup strcspn strspn strtoul strtol memcpy strpbrk memset setenv \
154 seteuid setresuid setpgrp \
155 tcsetattr tcflush basename fchdir media_oldaliases llseek lseek64 \
156 snprintf stat64 setlocale \
157 wcsdup wcscasecmp wcsnlen putwc \
158 getuserid getgroupid)
162 dnl Check for 64-bit off_t
164 AC_DEFUN(SFS_CHECK_OFF_T_64,
165 [AC_CACHE_CHECK(for 64-bit off_t, sfs_cv_off_t_64,
168 #include <sys/types.h>
170 switch (0) case 0: case (sizeof (off_t) <= 4):;
171 ], sfs_cv_off_t_64=no, sfs_cv_off_t_64=yes))
172 if test $sfs_cv_off_t_64 = yes; then
173 AC_DEFINE([HAVE_OFF_T_64],1,[Define when the system has a 64 bit off_t type])
180 dnl If the CC compiler supports `loff_t' type, define `HAVE_LOFF_T'.
182 AC_DEFUN(ICE_CC_LOFF_T,
184 AC_MSG_CHECKING(whether ${CC} supports loff_t type)
185 AC_CACHE_VAL(ice_cv_have_loff_t,
187 AC_TRY_COMPILE([#include <sys/types.h>],[loff_t a;],
188 ice_cv_have_loff_t=yes,
189 ice_cv_have_loff_t=no)
191 AC_MSG_RESULT($ice_cv_have_loff_t)
192 if test "$ice_cv_have_loff_t" = yes; then
193 AC_DEFINE([HAVE_LOFF_T],1,[Define when the compiler supports LOFF_T type])
201 dnl If the CC compiler supports `offset_t' type, define `HAVE_OFFSET_T'.
203 AC_DEFUN(ICE_CC_OFFSET_T,
205 AC_MSG_CHECKING(whether ${CC} supports offset_t type)
206 AC_CACHE_VAL(ice_cv_have_offset_t,
208 AC_TRY_COMPILE([#include <sys/types.h>],[offset_t a;],
209 ice_cv_have_offset_t=yes,
210 ice_cv_have_offset_t=no)
212 AC_MSG_RESULT($ice_cv_have_offset_t)
213 if test "$ice_cv_have_offset_t" = yes; then
214 AC_DEFINE([HAVE_OFFSET_T],1,[Define when the compiler supports OFFSET_T type])
221 dnl If the CC compiler supports `long long' type, define `HAVE_LONG_LONG'.
223 AC_DEFUN(ICE_CC_LONG_LONG,
225 AC_MSG_CHECKING(whether ${CC} supports long long type)
226 AC_CACHE_VAL(ice_cv_have_long_long,
228 AC_TRY_COMPILE(,[long long a;],
229 ice_cv_have_long_long=yes,
230 ice_cv_have_long_long=no)
232 AC_MSG_RESULT($ice_cv_have_long_long)
233 if test "$ice_cv_have_long_long" = yes; then
234 AC_DEFINE([HAVE_LONG_LONG],1,[Define when the compiler supports LONG_LONG type])
241 dnl If the CC compiler supports `long long' type, define `HAVE_OFF64_T'.
243 AC_DEFUN(ICE_CC_OFF64_T,
245 AC_MSG_CHECKING(whether ${CC} supports off64_t type)
246 AC_CACHE_VAL(ice_cv_have_off64_t,
248 AC_TRY_COMPILE(,[off64_t a;],
249 ice_cv_have_off64_t=yes,
250 ice_cv_have_off64_t=no)
252 AC_MSG_RESULT($ice_cv_have_off64_t)
253 if test "$ice_cv_have_off64_t" = yes; then
254 AC_DEFINE([HAVE_OFF64_T],1,[Define when the compiler supports OFF64_T type])
265 AC_CHECK_FUNCS(utimes utime, [break])
266 AC_CHECK_FUNCS(tzset gettimeofday)
271 host_os0=`echo $host_os | sed 's/-/_/g'`
272 host_os1=`echo $host_os0 | sed 's/\./_/g'`
273 host_os2=`echo $host_os0 | sed 's/^\([^.]*\)\..*$/\1/g'`
274 host_os3=`echo $host_os2 | sed 's/^\([^0-9]*\)[0-9]*$/\1/g'`
275 host_cpu1=`echo $host_cpu | sed 's/\./_/g'`
276 host_vendor1=`echo $host_vendor | sed 's/\./_/g'`
277 HOST_ID="-DCPU_$host_cpu1 -DVENDOR_$host_vendor1 -DOS_$host_os1"
278 if [ $host_os1 != $host_os2 ] ; then
279 HOST_ID="$HOST_ID -DOS_$host_os2"
281 if [ $host_os1 != $host_os3 ] && [ $host_os2 != $host_os3 ] ; then
282 HOST_ID="$HOST_ID -DOS_$host_os3"
285 my_host_os=`echo $host_os1 $host_os2 $host_os3 | sort -u`
286 objs=`echo $srcdir/*.c | sed 's/\.c$/.o/' `
287 if [ "X$GCC" = "Xyes" ] ; then
289 if [ "$host_os3" = sunos ] ; then
292 if [ "$host_os3" = ultrix ] ; then
295 if [ "$host_os3" = linux ] ; then
296 CFLAGS="$CFLAGS -fno-strength-reduce"
298 if [ "$host_os3" = aux ] ; then
300 MACHDEPLIBS="-lposix -UTIL"
303 arm*-*-linux) CFLAGS="$CFLAGS -mstructure-size-boundary=8";;
305 CFLAGS="$CFLAGS $Wall"
307 if [ $host_os3 = hpux ] ; then
308 CPPFLAGS="$CPPFLAGS -Ae"
311 if [ $host_os3 = xenix ] ; then
312 CFLAGS="$CFLAGS -M2e"
316 if [ $host_os3 = hpux ] ; then
317 LDFLAGS="$LDFLAGS -z"
320 if [ $host_os3 = xenix ] ; then
321 LDFLAGS="$LDFLAGS -M2e -i -f 5000"
324 if [ $host_os2 = sysv4 ] ; then
325 SHLIB="-lc -L/usr/ucblib -lucb"
330 if [ $host_os3 = isc ] ; then
331 CFLAGS="$CFLAGS -D_SYSV3"
335 if [ $host_os3 = solaris -a x$newVold = xxyes ] ; then
336 SHLIB="$SHLIB -s -lvolmgt"
339 if [ $host_os3 = nextstep ] ; then
340 CFLAGS="$CFLAGS -DBSD"
344 if [ -d /usr/5lib ] ; then
345 extralibdir=-L/usr/5lib
354 AC_ARG_ENABLE(floppyd,
355 [ --enable-floppyd floppy daemon support],
356 [if test x$enableval != x; then
357 use_floppyd=$enableval
360 AC_CHECK_LIB(socket,main)
361 dnl AC_CHECK_LIB(nsl,getpwnam)
362 AC_CHECK_LIB(bsd,main)
363 AC_CHECK_HEADERS(sys/socket.h arpa/inet.h netdb.h)
365 if test X$use_floppyd = X -a X$no_x = X ; then
369 if test X$use_floppyd = Xyes; then
370 if test X$no_x = Xyes ; then
371 echo "Floppyd needs X support" >&2
372 echo "To compile without floppyd, use ./configure --disable-floppyd" >&2
375 FLOPPYD="floppyd floppyd_installtest"
376 BINFLOPPYD="\$(DESTDIR)\$(bindir)/floppyd \$(DESTDIR)\$(bindir)/floppyd_installtest"
377 AC_DEFINE([USE_FLOPPYD],1,[Define when you want to include floppyd support])
386 AC_SUBST(extraincludedir)
387 AC_SUBST(extralibdir)
388 AC_SUBST(MACHDEPLIBS)