• Home
  • History
  • Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 dnl Check for configuration options
39 dnl Enable OS/2 extended density format disks
40 AC_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])
44 fi],AC_DEFINE([USE_XDF],1,[Define this if you want to use Xdf]))
45 
46 
47 dnl Check for configuration options
48 dnl Enable usage of vold on Solaris
49 AC_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])
53 fi])
54 
55 
56 dnl Check for configuration options
57 dnl Enable usage of vold on Solaris
58 AC_ARG_ENABLE(new-vold,
59 [  --enable-new-vold          compatibility with Solaris' vold, new version],
60 [newVold=x$enableval
61 if 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])
63 fi])
64 
65 
66 dnl Check for configuration options
67 dnl Debugging
68 AC_ARG_ENABLE(debug,
69 [  --enable-debug         debugging messages],
70 [if test x$enableval = xyes; then
71   AC_DEFINE([DEBUG],1,[Define for debugging messages])
72 fi])
73 
74 
75 dnl Check for configuration options
76 dnl Raw terminal code (enabled by default)
77 AC_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])
81 fi],
82 AC_DEFINE([USE_RAWTERM],1,[Define on non Unix OS'es which don't have the concept of tty's]))
83 
84 
85 dnl Checks for libraries.
86 
87 dnl AC_IRIX_SUN
88 AC_CHECK_LIB(sun, getpwnam)
89 AC_CHECK_LIB(cam, cam_open_device)
90 AC_CHECK_LIB(iconv, iconv)
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 io.h signal.h sys/signal.h utime.h sgtty.h \
98 sys/floppy.h mntent.h sys/sysmacros.h netinet/in.h netinet/tcp.h assert.h \
99 iconv.h wctype.h wchar.h locale.h xlocale.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 dnl Check for types
104 AC_SYS_LARGEFILE
105 AC_TYPE_INT8_T
106 AC_TYPE_INT16_T
107 AC_TYPE_INT32_T
108 AC_TYPE_UINT8_T
109 AC_TYPE_UINT16_T
110 AC_TYPE_UINT32_T
111 AC_TYPE_SSIZE_T
112 AC_TYPE_SIZE_T
113 AC_TYPE_OFF_T
114 AC_TYPE_SIGNAL
115 AC_TYPE_UID_T
116 
117 AC_CHECK_TYPES(caddr_t)
118 AC_CHECK_SIZEOF(size_t)
119 AC_CHECK_SIZEOF(time_t)
120 AC_CHECK_SIZEOF(long)
121 AC_CHECK_SIZEOF(long long)
122 
123 dnl
124 dnl Check to see if llseek() is declared in unistd.h.  On some libc's
125 dnl it is, and on others it isn't..... Thank you glibc developers....
126 dnl
127 dnl Warning!  Use of --enable-gcc-wall may throw off this test.
128 dnl
129 dnl
130 AC_MSG_CHECKING(whether llseek declared in unistd.h)
131 AC_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]))
136 AC_MSG_RESULT($mtools_cv_have_llseek_prototype)
137 if test "$mtools_cv_have_llseek_prototype" = yes; then
138    AC_DEFINE([HAVE_LLSEEK_PROTOTYPE],1,[Define when you have an LLSEEK prototype])
139 fi
140 
141 AC_MSG_CHECKING(whether lseek64 declared in unistd.h)
142 AC_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]))
150 AC_MSG_RESULT($mtools_cv_have_lseek64_prototype)
151 if test "$mtools_cv_have_lseek64_prototype" = yes; then
152    AC_DEFINE([HAVE_LSEEK64_PROTOTYPE],1,[Define when you have an LSEEK64 prototype])
153 fi
154 
155 
156 AC_CHECK_FUNCS(htons)
157 
158 dnl Apparently termio before termios is preferred by A/UX, AIX and SCO
159 
160 dnl Checks for typedefs, structures, and compiler characteristics.
161 AC_C_CONST
162 AC_C_INLINE
163 AC_TYPE_SIZE_T
164 AC_HEADER_TIME
165 AC_STRUCT_TM
166 
167 
168 dnl Checks for library functions.
169 AC_TYPE_SIGNAL
170 AC_CHECK_FUNCS(strerror random srandom strchr strrchr lockf flock \
171 strcasecmp strncasecmp strnlen atexit on_exit getpass memmove \
172 strdup strndup strcspn strspn strtoul strtol strtoll strtoi strtoui \
173 memcpy strpbrk memset setenv seteuid setresuid setpgrp \
174 tcsetattr tcflush basename fchdir media_oldaliases llseek lseek64 \
175 snprintf stat64 setlocale toupper_l strncasecmp_l \
176 wcsdup wcscasecmp wcsnlen putwc \
177 getuserid getgroupid \
178 alarm sigaction usleep)
179 
180 dnl
181 dnl Check for 64-bit off_t
182 dnl
183 AC_DEFUN(SFS_CHECK_OFF_T_64,
184 [AC_CACHE_CHECK(for 64-bit off_t, sfs_cv_off_t_64,
185 AC_TRY_COMPILE([
186 #include <unistd.h>
187 #include <sys/types.h>
188 ],[
189 switch (0) case 0: case (sizeof (off_t) <= 4):;
190 ], sfs_cv_off_t_64=no, sfs_cv_off_t_64=yes))
191 if 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])
193 fi])
194 
195 
196 dnl ICE_CC_LOFF_T
197 dnl -------------
198 dnl
199 dnl If the CC compiler supports `loff_t' type,  define `HAVE_LOFF_T'.
200 dnl
201 AC_DEFUN(ICE_CC_LOFF_T,
202 [
203 AC_MSG_CHECKING(whether ${CC} supports loff_t type)
204 AC_CACHE_VAL(ice_cv_have_loff_t,
205 [
206 AC_TRY_COMPILE([#include <sys/types.h>],[loff_t a;],
207 ice_cv_have_loff_t=yes,
208 ice_cv_have_loff_t=no)
209 ])
210 AC_MSG_RESULT($ice_cv_have_loff_t)
211 if test "$ice_cv_have_loff_t" = yes; then
212 AC_DEFINE([HAVE_LOFF_T],1,[Define when the compiler supports LOFF_T type])
213 fi
214 ])dnl
215 
216 
217 dnl ICE_CC_OFFSET_T
218 dnl -------------
219 dnl
220 dnl If the CC compiler supports `offset_t' type,  define `HAVE_OFFSET_T'.
221 dnl
222 AC_DEFUN(ICE_CC_OFFSET_T,
223 [
224 AC_MSG_CHECKING(whether ${CC} supports offset_t type)
225 AC_CACHE_VAL(ice_cv_have_offset_t,
226 [
227 AC_TRY_COMPILE([#include <sys/types.h>],[offset_t a;],
228 ice_cv_have_offset_t=yes,
229 ice_cv_have_offset_t=no)
230 ])
231 AC_MSG_RESULT($ice_cv_have_offset_t)
232 if test "$ice_cv_have_offset_t" = yes; then
233 AC_DEFINE([HAVE_OFFSET_T],1,[Define when the compiler supports OFFSET_T type])
234 fi
235 ])dnl
236 
237 dnl ICE_CC_LONG_LONG
238 dnl -------------
239 dnl
240 dnl If the CC compiler supports `long long' type,  define `HAVE_LONG_LONG'.
241 dnl
242 AC_DEFUN(ICE_CC_LONG_LONG,
243 [
244 AC_MSG_CHECKING(whether ${CC} supports long long type)
245 AC_CACHE_VAL(ice_cv_have_long_long,
246 [
247 AC_TRY_COMPILE(,[long long a;],
248 ice_cv_have_long_long=yes,
249 ice_cv_have_long_long=no)
250 ])
251 AC_MSG_RESULT($ice_cv_have_long_long)
252 if test "$ice_cv_have_long_long" = yes; then
253 AC_DEFINE([HAVE_LONG_LONG],1,[Define when the compiler supports LONG_LONG type])
254 fi
255 ])dnl
256 
257 dnl ICE_CC_OFF64_T
258 dnl -------------
259 dnl
260 dnl If the CC compiler supports `long long' type,  define `HAVE_OFF64_T'.
261 dnl
262 AC_DEFUN(ICE_CC_OFF64_T,
263 [
264 AC_MSG_CHECKING(whether ${CC} supports off64_t type)
265 AC_CACHE_VAL(ice_cv_have_off64_t,
266 [
267 AC_TRY_COMPILE(,[off64_t a;],
268 ice_cv_have_off64_t=yes,
269 ice_cv_have_off64_t=no)
270 ])
271 AC_MSG_RESULT($ice_cv_have_off64_t)
272 if test "$ice_cv_have_off64_t" = yes; then
273 AC_DEFINE([HAVE_OFF64_T],1,[Define when the compiler supports OFF64_T type])
274 fi
275 ])dnl
276 
277 
278 SFS_CHECK_OFF_T_64
279 ICE_CC_LOFF_T
280 ICE_CC_OFFSET_T
281 ICE_CC_LONG_LONG
282 
283 
284 AC_CHECK_FUNCS(utimes utime, [break])
285 AC_CHECK_FUNCS(tzset gettimeofday)
286 
287 CF_SYS_ERRLIST
288 
289 [
290 host_os0=`echo $host_os | sed 's/-/_/g'`
291 host_os1=`echo $host_os0 | sed 's/\./_/g'`
292 host_os2=`echo $host_os0 | sed 's/^\([^.]*\)\..*$/\1/g'`
293 host_os3=`echo $host_os2 | sed 's/^\([^0-9]*\)[0-9]*$/\1/g'`
294 host_cpu1=`echo $host_cpu | sed 's/\./_/g'`
295 host_vendor1=`echo $host_vendor | sed 's/\./_/g'`
296 HOST_ID="-DCPU_$host_cpu1 -DVENDOR_$host_vendor1 -DOS_$host_os1"
297 if [ $host_os1 != $host_os2 ] ; then
298 	HOST_ID="$HOST_ID -DOS_$host_os2"
299 fi
300 if [ $host_os1 != $host_os3 ] && [ $host_os2 != $host_os3 ] ; then
301 	HOST_ID="$HOST_ID -DOS_$host_os3"
302 fi
303 
304 my_host_os=`echo $host_os1 $host_os2 $host_os3 | sort -u`
305 objs=`echo $srcdir/*.c | sed 's/\.c$/.o/' `
306 if [ "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"
325 else
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
333 fi
334 
335 if [ $host_os3 = hpux ] ; then
336 	    LDFLAGS="$LDFLAGS -z"
337 fi
338 
339 if [ $host_os3 = xenix ] ; then
340     LDFLAGS="$LDFLAGS -M2e -i -f 5000"
341 fi
342 
343 if [ $host_os2 = sysv4 ] ; then
344     SHLIB="-lc -L/usr/ucblib -lucb"
345 else
346     SHLIB=""
347 fi
348 
349 if [ $host_os3 = isc ] ; then
350     CFLAGS="$CFLAGS -D_SYSV3"
351     SHLIB="-lc_s"
352 fi
353 
354 if [ $host_os3 = solaris -a x$newVold = xxyes ] ; then
355     SHLIB="$SHLIB -s -lvolmgt"
356 fi
357 
358 if [ $host_os3 = nextstep ] ; then
359     CFLAGS="$CFLAGS -DBSD"
360     SHLIB=""
361 fi
362 
363 if [ -d /usr/5lib ] ; then
364 	extralibdir=-L/usr/5lib
365 fi
366 
367 ]
368 
369 AC_PATH_X
370 AC_PATH_XTRA
371 
372 dnl Floppyd
373 AC_ARG_ENABLE(floppyd,
374 [  --enable-floppyd       floppy daemon support],
375 [if test x$enableval != x; then
376   use_floppyd=$enableval
377 fi])
378 
379 AC_CHECK_LIB(socket,main)
380 dnl AC_CHECK_LIB(nsl,getpwnam)
381 AC_CHECK_LIB(bsd,main)
382 AC_CHECK_HEADERS(sys/socket.h arpa/inet.h netdb.h)
383 
384 if test X$use_floppyd = X -a X$no_x = X ; then
385     use_floppyd="yes"
386 fi
387 
388 if 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
398 else
399     FLOPPYD=
400     BINFLOPPYD=
401 fi
402 
403 
404 AC_SUBST(FLOPPYD)
405 AC_SUBST(BINFLOPPYD)
406 AC_SUBST(extraincludedir)
407 AC_SUBST(extralibdir)
408 AC_SUBST(MACHDEPLIBS)
409 AC_SUBST(SHLIB)
410 AC_SUBST(host_cpu)
411 AC_SUBST(HOST_ID)
412 AC_OUTPUT(Makefile)
413