1 dnl Copyright 1996-2003,2005,2006,2008,2009,2022 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.
19 AC_CONFIG_SRCDIR([buffer.c])
20 AC_CONFIG_HEADERS([config.h])
22 dnl Checks for compiler
27 AC_PATH_PROG(INSTALL_INFO, install-info, "")
35 dnl Check for configuration options
36 dnl Enable OS/2 extended density format disks
38 [ --enable-xdf support for OS/2 extended density format disks],
39 [if test x$enableval = xyes; then
40 AC_DEFINE([USE_XDF],1,[Define this if you want to use Xdf])
43 fi],[AC_DEFINE([USE_XDF],1,[Define this if you want to use Xdf])
51 dnl Check for configuration options
52 dnl Enable usage of vold on Solaris
54 [ --enable-vold compatibility with Solaris' vold],
55 [if test x$enableval = xyes; then
56 AC_DEFINE([USING_VOLD],1,[Define this if you use mtools together with Solaris' vold])
60 dnl Check for configuration options
61 dnl Enable usage of vold on Solaris
62 AC_ARG_ENABLE(new-vold,
63 [ --enable-new-vold compatibility with Solaris' vold, new version],
65 if test x$enableval = xyes; then
66 AC_DEFINE([USING_NEW_VOLD],1,[Define this if you use mtools together with the new Solaris' vold support])
70 dnl Check for configuration options
73 [ --enable-debug debugging messages],
74 [if test x$enableval = xyes; then
75 AC_DEFINE([DEBUG],1,[Define for debugging messages])
79 dnl Check for configuration options
80 dnl Raw terminal code (enabled by default)
81 AC_ARG_ENABLE(raw_term,
82 [ --enable-raw-term raw terminal (readkey behaviour, default)],
83 [if test x$enableval = xyes; then
84 AC_DEFINE([USE_RAWTERM],1,[Define on non Unix OS'es which don't have the concept of tty's])
86 AC_DEFINE([USE_RAWTERM],1,[Define on non Unix OS'es which don't have the concept of tty's]))
89 dnl Checks for libraries.
92 AC_CHECK_LIB([sun],[getpwnam])
96 AC_CHECK_FUNCS(media_oldaliases)
99 AC_CHECK_LIB(cam, cam_open_device)
103 AC_CHECK_LIB(iconv, iconv)
106 dnl Checks for header files.
109 AC_CHECK_HEADERS(getopt.h stdarg.h inttypes.h \
110 libc.h fcntl.h limits.h sys/file.h sys/ioctl.h time.h sys/time.h \
111 sys/param.h memory.h malloc.h io.h signal.h sys/signal.h utime.h sgtty.h \
112 sys/floppy.h mntent.h sys/sysmacros.h assert.h \
113 iconv.h wctype.h wchar.h locale.h xlocale.h dirent.h)
114 AC_CHECK_HEADERS(termio.h sys/termio.h, [break])
115 AC_CHECK_HEADERS(termios.h sys/termios.h, [break])
117 dnl Check for platform-specific header files
118 AC_CHECK_HEADERS(sys/fdio.h)
135 AC_CHECK_TYPES(caddr_t)
136 AC_CHECK_TYPES(long long)
137 AC_CHECK_SIZEOF(size_t)
138 AC_CHECK_SIZEOF(off_t)
139 AC_CHECK_SIZEOF(time_t)
140 AC_CHECK_SIZEOF(long)
145 if test $ac_cv_sizeof_off_t -ge 8 ; then
149 dnl Fallback if we have no suitable 64 bit seek function yet
150 if test X$seek_function = X ; then
151 AC_DEFINE([_LARGEFILE64_SOURCE],1,[Needed for off64_t / lseek64 ])
152 AC_CHECK_TYPES(off64_t,
153 [ AC_CHECK_FUNCS(lseek64, [ seek_function=lseek64 ])
155 AC_CHECK_FUNCS(stat64)
156 if test X$seek_function = Xlseek64 ; then
157 AC_MSG_CHECKING(whether lseek64 declared in unistd.h)
158 AC_CACHE_VAL(mtools_cv_have_lseek64_prototype,
161 #define _LARGEFILE64_SOURCE
162 #include <sys/types.h>
164 ]], [[extern int lseek64(int);]])],
165 [mtools_cv_have_lseek64_prototype=no],
166 [mtools_cv_have_lseek64_prototype=yes]))
167 AC_MSG_RESULT($mtools_cv_have_lseek64_prototype)
168 if test "$mtools_cv_have_lseek64_prototype" = yes; then
169 AC_DEFINE([HAVE_LSEEK64_PROTOTYPE],1,[Define when you have an LSEEK64 prototype])
174 dnl Fallback if we have no suitable 64 bit seek function yet
175 if test X$seek_function = X ; then
176 AC_DEFINE([_LARGEFILE_SOURCE],1,[Might be needed for loff_t / llseek64 ])
177 AC_CHECK_TYPES([loff_t, offset_t, long long],
178 [ AC_CHECK_FUNCS(llseek, [ seek_function=llseek ])
181 if test X$seek_function = Xllseek ; then
183 dnl Check to see if llseek() is declared in unistd.h. On some libc's
184 dnl it is, and on others it isn't..... Thank you glibc developers....
186 dnl Warning! Use of --enable-gcc-wall may throw off this test.
189 AC_MSG_CHECKING(whether llseek declared in unistd.h)
190 AC_CACHE_VAL(mtools_cv_have_llseek_prototype,
193 #define _LARGEFILE_SOURCE
194 #define _LARGEFILE64_SOURCE
195 #include <sys/types.h>
197 ]], [[extern int llseek(int);]])],
198 [mtools_cv_have_llseek_prototype=no],
199 [mtools_cv_have_llseek_prototype=yes]))
200 AC_MSG_RESULT($mtools_cv_have_llseek_prototype)
201 if test "$mtools_cv_have_llseek_prototype" = yes; then
202 AC_DEFINE([HAVE_LLSEEK_PROTOTYPE],1,[Define when you have an LLSEEK prototype])
207 AC_CHECK_FUNCS(htons)
209 dnl Apparently termio before termios is preferred by A/UX, AIX and SCO
211 dnl Checks for typedefs, structures, and compiler characteristics.
219 dnl Checks for library functions.
221 AC_CHECK_FUNCS(strerror random srandom strchr strrchr lockf flock \
222 strcasecmp strncasecmp strnlen atexit on_exit getpass memmove \
223 strdup strndup strcspn strspn strtoul strtol strtoll strtoui \
224 memcpy strpbrk memset setenv seteuid setresuid \
225 tcsetattr tcflush basename \
226 readdir snprintf setlocale strstr toupper_l strncasecmp_l \
227 wcsdup wcscasecmp wcsnlen putwc \
228 alarm sigaction usleep lstat unsetenv mkdir)
231 AC_CHECK_FUNCS(utimes utime, [break])
232 AC_CHECK_FUNCS(tzset gettimeofday)
234 AC_CHECK_DECLS([sys_errlist, optarg])
237 host_os0=`echo $host_os | sed 's/-/_/g'`
238 host_os1=`echo $host_os0 | sed 's/\./_/g'`
239 host_os2=`echo $host_os0 | sed 's/^\([^.]*\)\..*$/\1/g'`
240 host_os3=`echo $host_os2 | sed 's/^\([^0-9]*\)[0-9]*$/\1/g'`
241 host_cpu1=`echo $host_cpu | sed 's/\./_/g'`
242 host_vendor1=`echo $host_vendor | sed 's/\./_/g'`
243 HOST_ID="-DCPU_$host_cpu1 -DVENDOR_$host_vendor1 -DOS_$host_os1"
244 if [ $host_os1 != $host_os2 ] ; then
245 HOST_ID="$HOST_ID -DOS_$host_os2"
247 if [ $host_os1 != $host_os3 ] && [ $host_os2 != $host_os3 ] ; then
248 HOST_ID="$HOST_ID -DOS_$host_os3"
251 my_host_os=`echo $host_os1 $host_os2 $host_os3 | sort -u`
252 objs=`echo $srcdir/*.c | sed 's/\.c$/.o/' `
253 if [ "X$GCC" = "Xyes" ] ; then
254 if [ "$host_os3" = aux ] ; then
256 MACHDEPLIBS="-lposix -UTIL"
259 arm*-*-linux) CFLAGS="$CFLAGS -mstructure-size-boundary=8";;
262 if [ $host_os3 = hpux ] ; then
263 CPPFLAGS="$CPPFLAGS -Ae"
266 if [ $host_os3 = xenix ] ; then
267 CFLAGS="$CFLAGS -M2e"
271 if [ $host_os3 = hpux ] ; then
272 LDFLAGS="$LDFLAGS -z"
275 if [ $host_os3 = xenix ] ; then
276 LDFLAGS="$LDFLAGS -M2e -i -f 5000"
279 if [ $host_os2 = sysv4 ] ; then
280 SHLIB="-lc -L/usr/ucblib -lucb"
285 if [ $host_os3 = isc ] ; then
286 CFLAGS="$CFLAGS -D_SYSV3"
290 if [ $host_os3 = solaris -a x$newVold = xxyes ] ; then
291 SHLIB="$SHLIB -s -lvolmgt"
294 if [ $host_os3 = nextstep ] ; then
295 CFLAGS="$CFLAGS -DBSD"
299 if [ -d /usr/5lib ] ; then
300 extralibdir=-L/usr/5lib
308 AC_ARG_ENABLE(floppyd,
309 [ --enable-floppyd floppy daemon support],
310 [if test x$enableval != x; then
311 use_floppyd=$enableval
314 if test X$use_floppyd = X -a X$no_x = X ; then
318 if test X$use_floppyd = Xyes; then
319 if test X$no_x = Xyes ; then
320 echo "Floppyd needs X support" >&2
321 echo "To compile without floppyd, use ./configure --disable-floppyd" >&2
324 FLOPPYD="floppyd floppyd_installtest"
325 BINFLOPPYD="\$(DESTDIR)\$(bindir)/floppyd \$(DESTDIR)\$(bindir)/floppyd_installtest"
326 FLOPPYD_IO_SRC=floppyd_io.c
327 FLOPPYD_IO_OBJ=floppyd_io.o
328 AC_DEFINE([USE_FLOPPYD],1,[Define when you want to include floppyd support])
329 AC_CHECK_FUNCS(setpgrp getuserid getgroupid)
333 AC_CHECK_LIB(X11, XOpenDisplay, [ FLOPPYD_LIBS="-lX11 $FLOPPYD_LIBS" ])
334 AC_CHECK_LIB(Xau, XauFileName, [ FLOPPYD_LIBS="-lXau $FLOPPYD_LIBS" ])
336 AC_CHECK_HEADERS(sys/socket.h arpa/inet.h netdb.h netinet/in.h \
337 netinet/tcp.h X11/Xauth.h X11/Xlib.h)
348 AC_SUBST(FLOPPYD_LIBS)
351 AC_SUBST(FLOPPYD_IO_SRC)
352 AC_SUBST(FLOPPYD_IO_OBJ)
354 AC_SUBST(extraincludedir)
355 AC_SUBST(extralibdir)
356 AC_SUBST(MACHDEPLIBS)
360 AC_CONFIG_FILES([Makefile])