Alistair Delva | beaee83 | 2021-02-24 11:27:23 -0800 | [diff] [blame] | 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) |
Yi Kong | 39bbd96 | 2022-01-09 19:41:38 +0800 | [diff] [blame] | 19 | m4_include([m4/ax_lib_socket_nsl.m4]) |
Alistair Delva | beaee83 | 2021-02-24 11:27:23 -0800 | [diff] [blame] | 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]) |
Yi Kong | 39bbd96 | 2022-01-09 19:41:38 +0800 | [diff] [blame] | 44 | XDF_IO_SRC=xdf_io.c |
| 45 | XDF_IO_OBJ=xdf_io.o |
| 46 | fi],[AC_DEFINE([USE_XDF],1,[Define this if you want to use Xdf]) |
| 47 | XDF_IO_SRC=xdf_io.c |
| 48 | XDF_IO_OBJ=xdf_io.o |
| 49 | ] |
| 50 | ) |
| 51 | AC_SUBST(XDF_IO_SRC) |
| 52 | AC_SUBST(XDF_IO_OBJ) |
Alistair Delva | beaee83 | 2021-02-24 11:27:23 -0800 | [diff] [blame] | 53 | |
| 54 | dnl Check for configuration options |
| 55 | dnl Enable usage of vold on Solaris |
| 56 | AC_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]) |
| 60 | fi]) |
| 61 | |
| 62 | |
| 63 | dnl Check for configuration options |
| 64 | dnl Enable usage of vold on Solaris |
| 65 | AC_ARG_ENABLE(new-vold, |
| 66 | [ --enable-new-vold compatibility with Solaris' vold, new version], |
| 67 | [newVold=x$enableval |
| 68 | if 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]) |
| 70 | fi]) |
| 71 | |
| 72 | |
| 73 | dnl Check for configuration options |
| 74 | dnl Debugging |
| 75 | AC_ARG_ENABLE(debug, |
| 76 | [ --enable-debug debugging messages], |
| 77 | [if test x$enableval = xyes; then |
| 78 | AC_DEFINE([DEBUG],1,[Define for debugging messages]) |
| 79 | fi]) |
| 80 | |
| 81 | |
| 82 | dnl Check for configuration options |
| 83 | dnl Raw terminal code (enabled by default) |
| 84 | AC_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]) |
| 88 | fi], |
| 89 | AC_DEFINE([USE_RAWTERM],1,[Define on non Unix OS'es which don't have the concept of tty's])) |
| 90 | |
| 91 | |
| 92 | dnl Checks for libraries. |
| 93 | |
| 94 | dnl AC_IRIX_SUN |
| 95 | AC_CHECK_LIB(sun, getpwnam) |
| 96 | AC_CHECK_LIB(cam, cam_open_device) |
| 97 | AC_CHECK_LIB(iconv, iconv) |
| 98 | |
Yi Kong | 39bbd96 | 2022-01-09 19:41:38 +0800 | [diff] [blame] | 99 | dnl Check for platform-specific libraries |
| 100 | AC_CHECK_LIB(socket,main) |
| 101 | AX_LIB_SOCKET_NSL |
| 102 | AC_CHECK_LIB(bsd,main) |
| 103 | |
Alistair Delva | beaee83 | 2021-02-24 11:27:23 -0800 | [diff] [blame] | 104 | dnl Checks for header files. |
| 105 | AC_HEADER_STDC |
| 106 | AC_HEADER_SYS_WAIT |
Yi Kong | 39bbd96 | 2022-01-09 19:41:38 +0800 | [diff] [blame] | 107 | AC_HEADER_STDBOOL |
| 108 | AC_CHECK_HEADERS(getopt.h stdarg.h stdlib.h unistd.h linux/unistd.h \ |
Alistair Delva | beaee83 | 2021-02-24 11:27:23 -0800 | [diff] [blame] | 109 | libc.h fcntl.h limits.h sys/file.h sys/ioctl.h sys/time.h strings.h string.h \ |
| 110 | sys/param.h memory.h malloc.h io.h signal.h sys/signal.h utime.h sgtty.h \ |
| 111 | sys/floppy.h mntent.h sys/sysmacros.h netinet/in.h netinet/tcp.h assert.h \ |
| 112 | iconv.h wctype.h wchar.h locale.h xlocale.h linux/fs.h) |
| 113 | AC_CHECK_HEADERS(termio.h sys/termio.h, [break]) |
| 114 | AC_CHECK_HEADERS(termios.h sys/termios.h, [break]) |
| 115 | |
Yi Kong | 39bbd96 | 2022-01-09 19:41:38 +0800 | [diff] [blame] | 116 | dnl Check for platform-specific header files |
| 117 | AC_CHECK_HEADERS(sys/fdio.h) |
| 118 | AC_CHECK_HEADERS(sys/socket.h arpa/inet.h netdb.h) |
| 119 | |
Alistair Delva | beaee83 | 2021-02-24 11:27:23 -0800 | [diff] [blame] | 120 | dnl Check for types |
| 121 | AC_SYS_LARGEFILE |
| 122 | AC_TYPE_INT8_T |
| 123 | AC_TYPE_INT16_T |
| 124 | AC_TYPE_INT32_T |
| 125 | AC_TYPE_UINT8_T |
| 126 | AC_TYPE_UINT16_T |
| 127 | AC_TYPE_UINT32_T |
| 128 | AC_TYPE_SSIZE_T |
| 129 | AC_TYPE_SIZE_T |
| 130 | AC_TYPE_OFF_T |
| 131 | AC_TYPE_SIGNAL |
| 132 | AC_TYPE_UID_T |
| 133 | |
| 134 | AC_CHECK_TYPES(caddr_t) |
Yi Kong | 39bbd96 | 2022-01-09 19:41:38 +0800 | [diff] [blame] | 135 | AC_CHECK_TYPES(long long) |
Alistair Delva | beaee83 | 2021-02-24 11:27:23 -0800 | [diff] [blame] | 136 | AC_CHECK_SIZEOF(size_t) |
Yi Kong | 39bbd96 | 2022-01-09 19:41:38 +0800 | [diff] [blame] | 137 | AC_CHECK_SIZEOF(off_t) |
Alistair Delva | beaee83 | 2021-02-24 11:27:23 -0800 | [diff] [blame] | 138 | AC_CHECK_SIZEOF(time_t) |
| 139 | AC_CHECK_SIZEOF(long) |
Alistair Delva | beaee83 | 2021-02-24 11:27:23 -0800 | [diff] [blame] | 140 | |
Yi Kong | 39bbd96 | 2022-01-09 19:41:38 +0800 | [diff] [blame] | 141 | seek_function= |
| 142 | |
| 143 | if test $ac_cv_sizeof_off_t -ge 8 ; then |
| 144 | seek_function=lseek |
Alistair Delva | beaee83 | 2021-02-24 11:27:23 -0800 | [diff] [blame] | 145 | fi |
| 146 | |
Yi Kong | 39bbd96 | 2022-01-09 19:41:38 +0800 | [diff] [blame] | 147 | dnl Fallback if we have no suitable 64 bit seek function yet |
| 148 | if 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 Delva | beaee83 | 2021-02-24 11:27:23 -0800 | [diff] [blame] | 163 | [mtools_cv_have_lseek64_prototype=no], |
| 164 | [mtools_cv_have_lseek64_prototype=yes])) |
Yi Kong | 39bbd96 | 2022-01-09 19:41:38 +0800 | [diff] [blame] | 165 | 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 Delva | beaee83 | 2021-02-24 11:27:23 -0800 | [diff] [blame] | 170 | fi |
| 171 | |
Yi Kong | 39bbd96 | 2022-01-09 19:41:38 +0800 | [diff] [blame] | 172 | dnl Fallback if we have no suitable 64 bit seek function yet |
| 173 | if 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 |
| 203 | fi |
Alistair Delva | beaee83 | 2021-02-24 11:27:23 -0800 | [diff] [blame] | 204 | |
| 205 | AC_CHECK_FUNCS(htons) |
| 206 | |
| 207 | dnl Apparently termio before termios is preferred by A/UX, AIX and SCO |
| 208 | |
| 209 | dnl Checks for typedefs, structures, and compiler characteristics. |
| 210 | AC_C_CONST |
| 211 | AC_C_INLINE |
| 212 | AC_TYPE_SIZE_T |
| 213 | AC_HEADER_TIME |
| 214 | AC_STRUCT_TM |
| 215 | |
| 216 | |
| 217 | dnl Checks for library functions. |
| 218 | AC_TYPE_SIGNAL |
| 219 | AC_CHECK_FUNCS(strerror random srandom strchr strrchr lockf flock \ |
| 220 | strcasecmp strncasecmp strnlen atexit on_exit getpass memmove \ |
| 221 | strdup strndup strcspn strspn strtoul strtol strtoll strtoi strtoui \ |
| 222 | memcpy strpbrk memset setenv seteuid setresuid setpgrp \ |
Yi Kong | 39bbd96 | 2022-01-09 19:41:38 +0800 | [diff] [blame] | 223 | tcsetattr tcflush basename fchdir media_oldaliases \ |
| 224 | snprintf setlocale toupper_l strncasecmp_l \ |
Alistair Delva | beaee83 | 2021-02-24 11:27:23 -0800 | [diff] [blame] | 225 | wcsdup wcscasecmp wcsnlen putwc \ |
| 226 | getuserid getgroupid \ |
| 227 | alarm sigaction usleep) |
| 228 | |
Alistair Delva | beaee83 | 2021-02-24 11:27:23 -0800 | [diff] [blame] | 229 | |
| 230 | AC_CHECK_FUNCS(utimes utime, [break]) |
| 231 | AC_CHECK_FUNCS(tzset gettimeofday) |
| 232 | |
| 233 | CF_SYS_ERRLIST |
| 234 | |
| 235 | [ |
| 236 | host_os0=`echo $host_os | sed 's/-/_/g'` |
| 237 | host_os1=`echo $host_os0 | sed 's/\./_/g'` |
| 238 | host_os2=`echo $host_os0 | sed 's/^\([^.]*\)\..*$/\1/g'` |
| 239 | host_os3=`echo $host_os2 | sed 's/^\([^0-9]*\)[0-9]*$/\1/g'` |
| 240 | host_cpu1=`echo $host_cpu | sed 's/\./_/g'` |
| 241 | host_vendor1=`echo $host_vendor | sed 's/\./_/g'` |
| 242 | HOST_ID="-DCPU_$host_cpu1 -DVENDOR_$host_vendor1 -DOS_$host_os1" |
| 243 | if [ $host_os1 != $host_os2 ] ; then |
| 244 | HOST_ID="$HOST_ID -DOS_$host_os2" |
| 245 | fi |
| 246 | if [ $host_os1 != $host_os3 ] && [ $host_os2 != $host_os3 ] ; then |
| 247 | HOST_ID="$HOST_ID -DOS_$host_os3" |
| 248 | fi |
| 249 | |
| 250 | my_host_os=`echo $host_os1 $host_os2 $host_os3 | sort -u` |
| 251 | objs=`echo $srcdir/*.c | sed 's/\.c$/.o/' ` |
| 252 | if [ "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" |
| 271 | else |
| 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 |
| 279 | fi |
| 280 | |
| 281 | if [ $host_os3 = hpux ] ; then |
| 282 | LDFLAGS="$LDFLAGS -z" |
| 283 | fi |
| 284 | |
| 285 | if [ $host_os3 = xenix ] ; then |
| 286 | LDFLAGS="$LDFLAGS -M2e -i -f 5000" |
| 287 | fi |
| 288 | |
| 289 | if [ $host_os2 = sysv4 ] ; then |
| 290 | SHLIB="-lc -L/usr/ucblib -lucb" |
| 291 | else |
| 292 | SHLIB="" |
| 293 | fi |
| 294 | |
| 295 | if [ $host_os3 = isc ] ; then |
| 296 | CFLAGS="$CFLAGS -D_SYSV3" |
| 297 | SHLIB="-lc_s" |
| 298 | fi |
| 299 | |
| 300 | if [ $host_os3 = solaris -a x$newVold = xxyes ] ; then |
| 301 | SHLIB="$SHLIB -s -lvolmgt" |
| 302 | fi |
| 303 | |
| 304 | if [ $host_os3 = nextstep ] ; then |
| 305 | CFLAGS="$CFLAGS -DBSD" |
| 306 | SHLIB="" |
| 307 | fi |
| 308 | |
| 309 | if [ -d /usr/5lib ] ; then |
| 310 | extralibdir=-L/usr/5lib |
| 311 | fi |
| 312 | |
| 313 | ] |
| 314 | |
| 315 | AC_PATH_X |
| 316 | AC_PATH_XTRA |
| 317 | |
| 318 | dnl Floppyd |
| 319 | AC_ARG_ENABLE(floppyd, |
| 320 | [ --enable-floppyd floppy daemon support], |
| 321 | [if test x$enableval != x; then |
| 322 | use_floppyd=$enableval |
| 323 | fi]) |
| 324 | |
Alistair Delva | beaee83 | 2021-02-24 11:27:23 -0800 | [diff] [blame] | 325 | if test X$use_floppyd = X -a X$no_x = X ; then |
| 326 | use_floppyd="yes" |
| 327 | fi |
| 328 | |
| 329 | if 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 Kong | 39bbd96 | 2022-01-09 19:41:38 +0800 | [diff] [blame] | 337 | FLOPPYD_IO_SRC=floppyd_io.c |
| 338 | FLOPPYD_IO_OBJ=floppyd_io.o |
Alistair Delva | beaee83 | 2021-02-24 11:27:23 -0800 | [diff] [blame] | 339 | AC_DEFINE([USE_FLOPPYD],1,[Define when you want to include floppyd support]) |
| 340 | AC_FUNC_SETPGRP |
Yi Kong | 39bbd96 | 2022-01-09 19:41:38 +0800 | [diff] [blame] | 341 | |
| 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 Delva | beaee83 | 2021-02-24 11:27:23 -0800 | [diff] [blame] | 345 | else |
| 346 | FLOPPYD= |
| 347 | BINFLOPPYD= |
Yi Kong | 39bbd96 | 2022-01-09 19:41:38 +0800 | [diff] [blame] | 348 | FLOPPYD_IO_SRC= |
| 349 | FLOPPYD_IO_OBJ= |
| 350 | FLOPPYD_LIBS= |
Alistair Delva | beaee83 | 2021-02-24 11:27:23 -0800 | [diff] [blame] | 351 | fi |
| 352 | |
| 353 | |
Yi Kong | 39bbd96 | 2022-01-09 19:41:38 +0800 | [diff] [blame] | 354 | |
| 355 | AC_SUBST(FLOPPYD_LIBS) |
Alistair Delva | beaee83 | 2021-02-24 11:27:23 -0800 | [diff] [blame] | 356 | AC_SUBST(FLOPPYD) |
| 357 | AC_SUBST(BINFLOPPYD) |
Yi Kong | 39bbd96 | 2022-01-09 19:41:38 +0800 | [diff] [blame] | 358 | AC_SUBST(FLOPPYD_IO_SRC) |
| 359 | AC_SUBST(FLOPPYD_IO_OBJ) |
| 360 | |
Alistair Delva | beaee83 | 2021-02-24 11:27:23 -0800 | [diff] [blame] | 361 | AC_SUBST(extraincludedir) |
| 362 | AC_SUBST(extralibdir) |
| 363 | AC_SUBST(MACHDEPLIBS) |
| 364 | AC_SUBST(SHLIB) |
| 365 | AC_SUBST(host_cpu) |
| 366 | AC_SUBST(HOST_ID) |
| 367 | AC_OUTPUT(Makefile) |