blob: 72cf205697e8c623205884a6d439e788224388c2 [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)
Yi Kong39bbd962022-01-09 19:41:38 +080019m4_include([m4/ax_lib_socket_nsl.m4])
Alistair Delvabeaee832021-02-24 11:27:23 -080020AC_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])
Yi Kong39bbd962022-01-09 19:41:38 +080044 XDF_IO_SRC=xdf_io.c
45 XDF_IO_OBJ=xdf_io.o
46fi],[AC_DEFINE([USE_XDF],1,[Define this if you want to use Xdf])
47XDF_IO_SRC=xdf_io.c
48XDF_IO_OBJ=xdf_io.o
49]
50)
51AC_SUBST(XDF_IO_SRC)
52AC_SUBST(XDF_IO_OBJ)
Alistair Delvabeaee832021-02-24 11:27:23 -080053
54dnl Check for configuration options
55dnl Enable usage of vold on Solaris
56AC_ARG_ENABLE(vold,
57[ --enable-vold compatibility with Solaris' vold],
58[if test x$enableval = xyes; then
59 AC_DEFINE([USING_VOLD],1,[Define this if you use mtools together with Solaris' vold])
60fi])
61
62
63dnl Check for configuration options
64dnl Enable usage of vold on Solaris
65AC_ARG_ENABLE(new-vold,
66[ --enable-new-vold compatibility with Solaris' vold, new version],
67[newVold=x$enableval
68if test x$enableval = xyes; then
69 AC_DEFINE([USING_NEW_VOLD],1,[Define this if you use mtools together with the new Solaris' vold support])
70fi])
71
72
73dnl Check for configuration options
74dnl Debugging
75AC_ARG_ENABLE(debug,
76[ --enable-debug debugging messages],
77[if test x$enableval = xyes; then
78 AC_DEFINE([DEBUG],1,[Define for debugging messages])
79fi])
80
81
82dnl Check for configuration options
83dnl Raw terminal code (enabled by default)
84AC_ARG_ENABLE(raw_term,
85[ --enable-raw-term raw terminal (readkey behaviour, default)],
86[if test x$enableval = xyes; then
87 AC_DEFINE([USE_RAWTERM],1,[Define on non Unix OS'es which don't have the concept of tty's])
88fi],
89AC_DEFINE([USE_RAWTERM],1,[Define on non Unix OS'es which don't have the concept of tty's]))
90
91
92dnl Checks for libraries.
93
94dnl AC_IRIX_SUN
95AC_CHECK_LIB(sun, getpwnam)
96AC_CHECK_LIB(cam, cam_open_device)
97AC_CHECK_LIB(iconv, iconv)
98
Yi Kong39bbd962022-01-09 19:41:38 +080099dnl Check for platform-specific libraries
100AC_CHECK_LIB(socket,main)
101AX_LIB_SOCKET_NSL
102AC_CHECK_LIB(bsd,main)
103
Alistair Delvabeaee832021-02-24 11:27:23 -0800104dnl Checks for header files.
105AC_HEADER_STDC
106AC_HEADER_SYS_WAIT
Yi Kong39bbd962022-01-09 19:41:38 +0800107AC_HEADER_STDBOOL
108AC_CHECK_HEADERS(getopt.h stdarg.h stdlib.h unistd.h linux/unistd.h \
Alistair Delvabeaee832021-02-24 11:27:23 -0800109libc.h fcntl.h limits.h sys/file.h sys/ioctl.h sys/time.h strings.h string.h \
110sys/param.h memory.h malloc.h io.h signal.h sys/signal.h utime.h sgtty.h \
111sys/floppy.h mntent.h sys/sysmacros.h netinet/in.h netinet/tcp.h assert.h \
112iconv.h wctype.h wchar.h locale.h xlocale.h linux/fs.h)
113AC_CHECK_HEADERS(termio.h sys/termio.h, [break])
114AC_CHECK_HEADERS(termios.h sys/termios.h, [break])
115
Yi Kong39bbd962022-01-09 19:41:38 +0800116dnl Check for platform-specific header files
117AC_CHECK_HEADERS(sys/fdio.h)
118AC_CHECK_HEADERS(sys/socket.h arpa/inet.h netdb.h)
119
Alistair Delvabeaee832021-02-24 11:27:23 -0800120dnl Check for types
121AC_SYS_LARGEFILE
122AC_TYPE_INT8_T
123AC_TYPE_INT16_T
124AC_TYPE_INT32_T
125AC_TYPE_UINT8_T
126AC_TYPE_UINT16_T
127AC_TYPE_UINT32_T
128AC_TYPE_SSIZE_T
129AC_TYPE_SIZE_T
130AC_TYPE_OFF_T
131AC_TYPE_SIGNAL
132AC_TYPE_UID_T
133
134AC_CHECK_TYPES(caddr_t)
Yi Kong39bbd962022-01-09 19:41:38 +0800135AC_CHECK_TYPES(long long)
Alistair Delvabeaee832021-02-24 11:27:23 -0800136AC_CHECK_SIZEOF(size_t)
Yi Kong39bbd962022-01-09 19:41:38 +0800137AC_CHECK_SIZEOF(off_t)
Alistair Delvabeaee832021-02-24 11:27:23 -0800138AC_CHECK_SIZEOF(time_t)
139AC_CHECK_SIZEOF(long)
Alistair Delvabeaee832021-02-24 11:27:23 -0800140
Yi Kong39bbd962022-01-09 19:41:38 +0800141seek_function=
142
143if test $ac_cv_sizeof_off_t -ge 8 ; then
144 seek_function=lseek
Alistair Delvabeaee832021-02-24 11:27:23 -0800145fi
146
Yi Kong39bbd962022-01-09 19:41:38 +0800147dnl Fallback if we have no suitable 64 bit seek function yet
148if test X$seek_function = X ; then
149 AC_DEFINE([_LARGEFILE64_SOURCE],1,[Needed for off64_t / lseek64 ])
150 AC_CHECK_TYPES(off64_t,
151 [ AC_CHECK_FUNCS(lseek64, [ seek_function=lseek64 ])
152 ])
153 AC_CHECK_FUNCS(stat64)
154 if test X$seek_function = Xlseek64 ; then
155 AC_MSG_CHECKING(whether lseek64 declared in unistd.h)
156 AC_CACHE_VAL(mtools_cv_have_lseek64_prototype,
157 AC_COMPILE_IFELSE(
158 [AC_LANG_PROGRAM([[
159 #define _LARGEFILE64_SOURCE
160 #include <sys/types.h>
161 #include <unistd.h>
162 ]], [[extern int lseek64(int);]])],
Alistair Delvabeaee832021-02-24 11:27:23 -0800163 [mtools_cv_have_lseek64_prototype=no],
164 [mtools_cv_have_lseek64_prototype=yes]))
Yi Kong39bbd962022-01-09 19:41:38 +0800165 AC_MSG_RESULT($mtools_cv_have_lseek64_prototype)
166 if test "$mtools_cv_have_lseek64_prototype" = yes; then
167 AC_DEFINE([HAVE_LSEEK64_PROTOTYPE],1,[Define when you have an LSEEK64 prototype])
168 fi
169 fi
Alistair Delvabeaee832021-02-24 11:27:23 -0800170fi
171
Yi Kong39bbd962022-01-09 19:41:38 +0800172dnl Fallback if we have no suitable 64 bit seek function yet
173if test X$seek_function = X ; then
174 AC_DEFINE([_LARGEFILE_SOURCE],1,[Might be needed for loff_t / llseek64 ])
175 AC_CHECK_TYPES([loff_t, offset_t, long long],
176 [ AC_CHECK_FUNCS(llseek, [ seek_function=llseek ])
177 ])
178
179 if test X$seek_function = Xllseek ; then
180 dnl
181 dnl Check to see if llseek() is declared in unistd.h. On some libc's
182 dnl it is, and on others it isn't..... Thank you glibc developers....
183 dnl
184 dnl Warning! Use of --enable-gcc-wall may throw off this test.
185 dnl
186 dnl
187 AC_MSG_CHECKING(whether llseek declared in unistd.h)
188 AC_CACHE_VAL(mtools_cv_have_llseek_prototype,
189 AC_COMPILE_IFELSE(
190 [AC_LANG_PROGRAM([[
191 #define _LARGEFILE_SOURCE
192 #define _LARGEFILE64_SOURCE
193 #include <sys/types.h>
194 #include <unistd.h>
195 ]], [[extern int llseek(int);]])],
196 [mtools_cv_have_llseek_prototype=no],
197 [mtools_cv_have_llseek_prototype=yes]))
198 AC_MSG_RESULT($mtools_cv_have_llseek_prototype)
199 if test "$mtools_cv_have_llseek_prototype" = yes; then
200 AC_DEFINE([HAVE_LLSEEK_PROTOTYPE],1,[Define when you have an LLSEEK prototype])
201 fi
202 fi
203fi
Alistair Delvabeaee832021-02-24 11:27:23 -0800204
205AC_CHECK_FUNCS(htons)
206
207dnl Apparently termio before termios is preferred by A/UX, AIX and SCO
208
209dnl Checks for typedefs, structures, and compiler characteristics.
210AC_C_CONST
211AC_C_INLINE
212AC_TYPE_SIZE_T
213AC_HEADER_TIME
214AC_STRUCT_TM
215
216
217dnl Checks for library functions.
218AC_TYPE_SIGNAL
219AC_CHECK_FUNCS(strerror random srandom strchr strrchr lockf flock \
220strcasecmp strncasecmp strnlen atexit on_exit getpass memmove \
221strdup strndup strcspn strspn strtoul strtol strtoll strtoi strtoui \
222memcpy strpbrk memset setenv seteuid setresuid setpgrp \
Yi Kong39bbd962022-01-09 19:41:38 +0800223tcsetattr tcflush basename fchdir media_oldaliases \
224snprintf setlocale toupper_l strncasecmp_l \
Alistair Delvabeaee832021-02-24 11:27:23 -0800225wcsdup wcscasecmp wcsnlen putwc \
226getuserid getgroupid \
227alarm sigaction usleep)
228
Alistair Delvabeaee832021-02-24 11:27:23 -0800229
230AC_CHECK_FUNCS(utimes utime, [break])
231AC_CHECK_FUNCS(tzset gettimeofday)
232
233CF_SYS_ERRLIST
234
235[
236host_os0=`echo $host_os | sed 's/-/_/g'`
237host_os1=`echo $host_os0 | sed 's/\./_/g'`
238host_os2=`echo $host_os0 | sed 's/^\([^.]*\)\..*$/\1/g'`
239host_os3=`echo $host_os2 | sed 's/^\([^0-9]*\)[0-9]*$/\1/g'`
240host_cpu1=`echo $host_cpu | sed 's/\./_/g'`
241host_vendor1=`echo $host_vendor | sed 's/\./_/g'`
242HOST_ID="-DCPU_$host_cpu1 -DVENDOR_$host_vendor1 -DOS_$host_os1"
243if [ $host_os1 != $host_os2 ] ; then
244 HOST_ID="$HOST_ID -DOS_$host_os2"
245fi
246if [ $host_os1 != $host_os3 ] && [ $host_os2 != $host_os3 ] ; then
247 HOST_ID="$HOST_ID -DOS_$host_os3"
248fi
249
250my_host_os=`echo $host_os1 $host_os2 $host_os3 | sort -u`
251objs=`echo $srcdir/*.c | sed 's/\.c$/.o/' `
252if [ "X$GCC" = "Xyes" ] ; then
253 Wall=-Wall
254 if [ "$host_os3" = sunos ] ; then
255 Wall=""
256 fi
257 if [ "$host_os3" = ultrix ] ; then
258 Wall=""
259 fi
260 if [ "$host_os3" = linux ] ; then
261 CFLAGS="$CFLAGS -fno-strength-reduce"
262 fi
263 if [ "$host_os3" = aux ] ; then
264 CFLAGS="$CFLAGS -ZP"
265 MACHDEPLIBS="-lposix -UTIL"
266 fi
267 case "${host}" in
268 arm*-*-linux) CFLAGS="$CFLAGS -mstructure-size-boundary=8";;
269 esac
270 CFLAGS="$CFLAGS $Wall"
271else
272 if [ $host_os3 = hpux ] ; then
273 CPPFLAGS="$CPPFLAGS -Ae"
274 fi
275
276 if [ $host_os3 = xenix ] ; then
277 CFLAGS="$CFLAGS -M2e"
278 fi
279fi
280
281if [ $host_os3 = hpux ] ; then
282 LDFLAGS="$LDFLAGS -z"
283fi
284
285if [ $host_os3 = xenix ] ; then
286 LDFLAGS="$LDFLAGS -M2e -i -f 5000"
287fi
288
289if [ $host_os2 = sysv4 ] ; then
290 SHLIB="-lc -L/usr/ucblib -lucb"
291else
292 SHLIB=""
293fi
294
295if [ $host_os3 = isc ] ; then
296 CFLAGS="$CFLAGS -D_SYSV3"
297 SHLIB="-lc_s"
298fi
299
300if [ $host_os3 = solaris -a x$newVold = xxyes ] ; then
301 SHLIB="$SHLIB -s -lvolmgt"
302fi
303
304if [ $host_os3 = nextstep ] ; then
305 CFLAGS="$CFLAGS -DBSD"
306 SHLIB=""
307fi
308
309if [ -d /usr/5lib ] ; then
310 extralibdir=-L/usr/5lib
311fi
312
313]
314
315AC_PATH_X
316AC_PATH_XTRA
317
318dnl Floppyd
319AC_ARG_ENABLE(floppyd,
320[ --enable-floppyd floppy daemon support],
321[if test x$enableval != x; then
322 use_floppyd=$enableval
323fi])
324
Alistair Delvabeaee832021-02-24 11:27:23 -0800325if test X$use_floppyd = X -a X$no_x = X ; then
326 use_floppyd="yes"
327fi
328
329if test X$use_floppyd = Xyes; then
330 if test X$no_x = Xyes ; then
331 echo "Floppyd needs X support" >&2
332 echo "To compile without floppyd, use ./configure --disable-floppyd" >&2
333 exit 1
334 fi
335 FLOPPYD="floppyd floppyd_installtest"
336 BINFLOPPYD="\$(DESTDIR)\$(bindir)/floppyd \$(DESTDIR)\$(bindir)/floppyd_installtest"
Yi Kong39bbd962022-01-09 19:41:38 +0800337 FLOPPYD_IO_SRC=floppyd_io.c
338 FLOPPYD_IO_OBJ=floppyd_io.o
Alistair Delvabeaee832021-02-24 11:27:23 -0800339 AC_DEFINE([USE_FLOPPYD],1,[Define when you want to include floppyd support])
340 AC_FUNC_SETPGRP
Yi Kong39bbd962022-01-09 19:41:38 +0800341
342 FLOPPYD_LIBS=""
343 AC_CHECK_LIB(X11, XOpenDisplay, [ FLOPPYD_LIBS="-lX11 $FLOPPYD_LIBS" ])
344 AC_CHECK_LIB(Xau, XauFileName, [ FLOPPYD_LIBS="-lXau $FLOPPYD_LIBS" ])
Alistair Delvabeaee832021-02-24 11:27:23 -0800345else
346 FLOPPYD=
347 BINFLOPPYD=
Yi Kong39bbd962022-01-09 19:41:38 +0800348 FLOPPYD_IO_SRC=
349 FLOPPYD_IO_OBJ=
350 FLOPPYD_LIBS=
Alistair Delvabeaee832021-02-24 11:27:23 -0800351fi
352
353
Yi Kong39bbd962022-01-09 19:41:38 +0800354
355AC_SUBST(FLOPPYD_LIBS)
Alistair Delvabeaee832021-02-24 11:27:23 -0800356AC_SUBST(FLOPPYD)
357AC_SUBST(BINFLOPPYD)
Yi Kong39bbd962022-01-09 19:41:38 +0800358AC_SUBST(FLOPPYD_IO_SRC)
359AC_SUBST(FLOPPYD_IO_OBJ)
360
Alistair Delvabeaee832021-02-24 11:27:23 -0800361AC_SUBST(extraincludedir)
362AC_SUBST(extralibdir)
363AC_SUBST(MACHDEPLIBS)
364AC_SUBST(SHLIB)
365AC_SUBST(host_cpu)
366AC_SUBST(HOST_ID)
367AC_OUTPUT(Makefile)