aboutsummaryrefslogtreecommitdiff
path: root/configure.in
diff options
context:
space:
mode:
Diffstat (limited to 'configure.in')
-rw-r--r--configure.in237
1 files changed, 96 insertions, 141 deletions
diff --git a/configure.in b/configure.in
index 5ff75c1..72cf205 100644
--- a/configure.in
+++ b/configure.in
@@ -16,7 +16,7 @@ dnl along with Mtools. If not, see <http://www.gnu.org/licenses/>.
dnl
dnl Process this file with autoconf to produce a configure script.
AC_INIT(buffer.c)
-
+m4_include([m4/ax_lib_socket_nsl.m4])
AC_CONFIG_HEADER(config.h)
dnl Checks for compiler
@@ -41,8 +41,15 @@ AC_ARG_ENABLE(xdf,
[ --enable-xdf support for OS/2 extended density format disks],
[if test x$enableval = xyes; then
AC_DEFINE([USE_XDF],1,[Define this if you want to use Xdf])
-fi],AC_DEFINE([USE_XDF],1,[Define this if you want to use Xdf]))
-
+ XDF_IO_SRC=xdf_io.c
+ XDF_IO_OBJ=xdf_io.o
+fi],[AC_DEFINE([USE_XDF],1,[Define this if you want to use Xdf])
+XDF_IO_SRC=xdf_io.c
+XDF_IO_OBJ=xdf_io.o
+]
+)
+AC_SUBST(XDF_IO_SRC)
+AC_SUBST(XDF_IO_OBJ)
dnl Check for configuration options
dnl Enable usage of vold on Solaris
@@ -89,10 +96,16 @@ AC_CHECK_LIB(sun, getpwnam)
AC_CHECK_LIB(cam, cam_open_device)
AC_CHECK_LIB(iconv, iconv)
+dnl Check for platform-specific libraries
+AC_CHECK_LIB(socket,main)
+AX_LIB_SOCKET_NSL
+AC_CHECK_LIB(bsd,main)
+
dnl Checks for header files.
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
-AC_CHECK_HEADERS(getopt.h sys/stat.h stdlib.h unistd.h linux/unistd.h \
+AC_HEADER_STDBOOL
+AC_CHECK_HEADERS(getopt.h stdarg.h stdlib.h unistd.h linux/unistd.h \
libc.h fcntl.h limits.h sys/file.h sys/ioctl.h sys/time.h strings.h string.h \
sys/param.h memory.h malloc.h io.h signal.h sys/signal.h utime.h sgtty.h \
sys/floppy.h mntent.h sys/sysmacros.h netinet/in.h netinet/tcp.h assert.h \
@@ -100,6 +113,10 @@ iconv.h wctype.h wchar.h locale.h xlocale.h linux/fs.h)
AC_CHECK_HEADERS(termio.h sys/termio.h, [break])
AC_CHECK_HEADERS(termios.h sys/termios.h, [break])
+dnl Check for platform-specific header files
+AC_CHECK_HEADERS(sys/fdio.h)
+AC_CHECK_HEADERS(sys/socket.h arpa/inet.h netdb.h)
+
dnl Check for types
AC_SYS_LARGEFILE
AC_TYPE_INT8_T
@@ -115,43 +132,75 @@ AC_TYPE_SIGNAL
AC_TYPE_UID_T
AC_CHECK_TYPES(caddr_t)
+AC_CHECK_TYPES(long long)
AC_CHECK_SIZEOF(size_t)
+AC_CHECK_SIZEOF(off_t)
AC_CHECK_SIZEOF(time_t)
AC_CHECK_SIZEOF(long)
-AC_CHECK_SIZEOF(long long)
-dnl
-dnl Check to see if llseek() is declared in unistd.h. On some libc's
-dnl it is, and on others it isn't..... Thank you glibc developers....
-dnl
-dnl Warning! Use of --enable-gcc-wall may throw off this test.
-dnl
-dnl
-AC_MSG_CHECKING(whether llseek declared in unistd.h)
-AC_CACHE_VAL(mtools_cv_have_llseek_prototype,
- AC_TRY_COMPILE(
-[#include <unistd.h>], [extern int llseek(int);],
- [mtools_cv_have_llseek_prototype=no],
- [mtools_cv_have_llseek_prototype=yes]))
-AC_MSG_RESULT($mtools_cv_have_llseek_prototype)
-if test "$mtools_cv_have_llseek_prototype" = yes; then
- AC_DEFINE([HAVE_LLSEEK_PROTOTYPE],1,[Define when you have an LLSEEK prototype])
+seek_function=
+
+if test $ac_cv_sizeof_off_t -ge 8 ; then
+ seek_function=lseek
fi
-AC_MSG_CHECKING(whether lseek64 declared in unistd.h)
-AC_CACHE_VAL(mtools_cv_have_lseek64_prototype,
- AC_TRY_COMPILE(
-[
-#include "sysincludes.h"
-#include <unistd.h>
-], [extern int lseek64(int);],
+dnl Fallback if we have no suitable 64 bit seek function yet
+if test X$seek_function = X ; then
+ AC_DEFINE([_LARGEFILE64_SOURCE],1,[Needed for off64_t / lseek64 ])
+ AC_CHECK_TYPES(off64_t,
+ [ AC_CHECK_FUNCS(lseek64, [ seek_function=lseek64 ])
+ ])
+ AC_CHECK_FUNCS(stat64)
+ if test X$seek_function = Xlseek64 ; then
+ AC_MSG_CHECKING(whether lseek64 declared in unistd.h)
+ AC_CACHE_VAL(mtools_cv_have_lseek64_prototype,
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([[
+ #define _LARGEFILE64_SOURCE
+ #include <sys/types.h>
+ #include <unistd.h>
+ ]], [[extern int lseek64(int);]])],
[mtools_cv_have_lseek64_prototype=no],
[mtools_cv_have_lseek64_prototype=yes]))
-AC_MSG_RESULT($mtools_cv_have_lseek64_prototype)
-if test "$mtools_cv_have_lseek64_prototype" = yes; then
- AC_DEFINE([HAVE_LSEEK64_PROTOTYPE],1,[Define when you have an LSEEK64 prototype])
+ AC_MSG_RESULT($mtools_cv_have_lseek64_prototype)
+ if test "$mtools_cv_have_lseek64_prototype" = yes; then
+ AC_DEFINE([HAVE_LSEEK64_PROTOTYPE],1,[Define when you have an LSEEK64 prototype])
+ fi
+ fi
fi
+dnl Fallback if we have no suitable 64 bit seek function yet
+if test X$seek_function = X ; then
+ AC_DEFINE([_LARGEFILE_SOURCE],1,[Might be needed for loff_t / llseek64 ])
+ AC_CHECK_TYPES([loff_t, offset_t, long long],
+ [ AC_CHECK_FUNCS(llseek, [ seek_function=llseek ])
+ ])
+
+ if test X$seek_function = Xllseek ; then
+ dnl
+ dnl Check to see if llseek() is declared in unistd.h. On some libc's
+ dnl it is, and on others it isn't..... Thank you glibc developers....
+ dnl
+ dnl Warning! Use of --enable-gcc-wall may throw off this test.
+ dnl
+ dnl
+ AC_MSG_CHECKING(whether llseek declared in unistd.h)
+ AC_CACHE_VAL(mtools_cv_have_llseek_prototype,
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([[
+ #define _LARGEFILE_SOURCE
+ #define _LARGEFILE64_SOURCE
+ #include <sys/types.h>
+ #include <unistd.h>
+ ]], [[extern int llseek(int);]])],
+ [mtools_cv_have_llseek_prototype=no],
+ [mtools_cv_have_llseek_prototype=yes]))
+ AC_MSG_RESULT($mtools_cv_have_llseek_prototype)
+ if test "$mtools_cv_have_llseek_prototype" = yes; then
+ AC_DEFINE([HAVE_LLSEEK_PROTOTYPE],1,[Define when you have an LLSEEK prototype])
+ fi
+ fi
+fi
AC_CHECK_FUNCS(htons)
@@ -171,115 +220,12 @@ AC_CHECK_FUNCS(strerror random srandom strchr strrchr lockf flock \
strcasecmp strncasecmp strnlen atexit on_exit getpass memmove \
strdup strndup strcspn strspn strtoul strtol strtoll strtoi strtoui \
memcpy strpbrk memset setenv seteuid setresuid setpgrp \
-tcsetattr tcflush basename fchdir media_oldaliases llseek lseek64 \
-snprintf stat64 setlocale toupper_l strncasecmp_l \
+tcsetattr tcflush basename fchdir media_oldaliases \
+snprintf setlocale toupper_l strncasecmp_l \
wcsdup wcscasecmp wcsnlen putwc \
getuserid getgroupid \
alarm sigaction usleep)
-dnl
-dnl Check for 64-bit off_t
-dnl
-AC_DEFUN(SFS_CHECK_OFF_T_64,
-[AC_CACHE_CHECK(for 64-bit off_t, sfs_cv_off_t_64,
-AC_TRY_COMPILE([
-#include <unistd.h>
-#include <sys/types.h>
-],[
-switch (0) case 0: case (sizeof (off_t) <= 4):;
-], sfs_cv_off_t_64=no, sfs_cv_off_t_64=yes))
-if test $sfs_cv_off_t_64 = yes; then
- AC_DEFINE([HAVE_OFF_T_64],1,[Define when the system has a 64 bit off_t type])
-fi])
-
-
-dnl ICE_CC_LOFF_T
-dnl -------------
-dnl
-dnl If the CC compiler supports `loff_t' type, define `HAVE_LOFF_T'.
-dnl
-AC_DEFUN(ICE_CC_LOFF_T,
-[
-AC_MSG_CHECKING(whether ${CC} supports loff_t type)
-AC_CACHE_VAL(ice_cv_have_loff_t,
-[
-AC_TRY_COMPILE([#include <sys/types.h>],[loff_t a;],
-ice_cv_have_loff_t=yes,
-ice_cv_have_loff_t=no)
-])
-AC_MSG_RESULT($ice_cv_have_loff_t)
-if test "$ice_cv_have_loff_t" = yes; then
-AC_DEFINE([HAVE_LOFF_T],1,[Define when the compiler supports LOFF_T type])
-fi
-])dnl
-
-
-dnl ICE_CC_OFFSET_T
-dnl -------------
-dnl
-dnl If the CC compiler supports `offset_t' type, define `HAVE_OFFSET_T'.
-dnl
-AC_DEFUN(ICE_CC_OFFSET_T,
-[
-AC_MSG_CHECKING(whether ${CC} supports offset_t type)
-AC_CACHE_VAL(ice_cv_have_offset_t,
-[
-AC_TRY_COMPILE([#include <sys/types.h>],[offset_t a;],
-ice_cv_have_offset_t=yes,
-ice_cv_have_offset_t=no)
-])
-AC_MSG_RESULT($ice_cv_have_offset_t)
-if test "$ice_cv_have_offset_t" = yes; then
-AC_DEFINE([HAVE_OFFSET_T],1,[Define when the compiler supports OFFSET_T type])
-fi
-])dnl
-
-dnl ICE_CC_LONG_LONG
-dnl -------------
-dnl
-dnl If the CC compiler supports `long long' type, define `HAVE_LONG_LONG'.
-dnl
-AC_DEFUN(ICE_CC_LONG_LONG,
-[
-AC_MSG_CHECKING(whether ${CC} supports long long type)
-AC_CACHE_VAL(ice_cv_have_long_long,
-[
-AC_TRY_COMPILE(,[long long a;],
-ice_cv_have_long_long=yes,
-ice_cv_have_long_long=no)
-])
-AC_MSG_RESULT($ice_cv_have_long_long)
-if test "$ice_cv_have_long_long" = yes; then
-AC_DEFINE([HAVE_LONG_LONG],1,[Define when the compiler supports LONG_LONG type])
-fi
-])dnl
-
-dnl ICE_CC_OFF64_T
-dnl -------------
-dnl
-dnl If the CC compiler supports `long long' type, define `HAVE_OFF64_T'.
-dnl
-AC_DEFUN(ICE_CC_OFF64_T,
-[
-AC_MSG_CHECKING(whether ${CC} supports off64_t type)
-AC_CACHE_VAL(ice_cv_have_off64_t,
-[
-AC_TRY_COMPILE(,[off64_t a;],
-ice_cv_have_off64_t=yes,
-ice_cv_have_off64_t=no)
-])
-AC_MSG_RESULT($ice_cv_have_off64_t)
-if test "$ice_cv_have_off64_t" = yes; then
-AC_DEFINE([HAVE_OFF64_T],1,[Define when the compiler supports OFF64_T type])
-fi
-])dnl
-
-
-SFS_CHECK_OFF_T_64
-ICE_CC_LOFF_T
-ICE_CC_OFFSET_T
-ICE_CC_LONG_LONG
-
AC_CHECK_FUNCS(utimes utime, [break])
AC_CHECK_FUNCS(tzset gettimeofday)
@@ -376,11 +322,6 @@ AC_ARG_ENABLE(floppyd,
use_floppyd=$enableval
fi])
-AC_CHECK_LIB(socket,main)
-dnl AC_CHECK_LIB(nsl,getpwnam)
-AC_CHECK_LIB(bsd,main)
-AC_CHECK_HEADERS(sys/socket.h arpa/inet.h netdb.h)
-
if test X$use_floppyd = X -a X$no_x = X ; then
use_floppyd="yes"
fi
@@ -393,16 +334,30 @@ if test X$use_floppyd = Xyes; then
fi
FLOPPYD="floppyd floppyd_installtest"
BINFLOPPYD="\$(DESTDIR)\$(bindir)/floppyd \$(DESTDIR)\$(bindir)/floppyd_installtest"
+ FLOPPYD_IO_SRC=floppyd_io.c
+ FLOPPYD_IO_OBJ=floppyd_io.o
AC_DEFINE([USE_FLOPPYD],1,[Define when you want to include floppyd support])
AC_FUNC_SETPGRP
+
+ FLOPPYD_LIBS=""
+ AC_CHECK_LIB(X11, XOpenDisplay, [ FLOPPYD_LIBS="-lX11 $FLOPPYD_LIBS" ])
+ AC_CHECK_LIB(Xau, XauFileName, [ FLOPPYD_LIBS="-lXau $FLOPPYD_LIBS" ])
else
FLOPPYD=
BINFLOPPYD=
+ FLOPPYD_IO_SRC=
+ FLOPPYD_IO_OBJ=
+ FLOPPYD_LIBS=
fi
+
+AC_SUBST(FLOPPYD_LIBS)
AC_SUBST(FLOPPYD)
AC_SUBST(BINFLOPPYD)
+AC_SUBST(FLOPPYD_IO_SRC)
+AC_SUBST(FLOPPYD_IO_OBJ)
+
AC_SUBST(extraincludedir)
AC_SUBST(extralibdir)
AC_SUBST(MACHDEPLIBS)