Alistair Delva | beaee83 | 2021-02-24 11:27:23 -0800 | [diff] [blame] | 1 | /* Copyright 1996-1999,2001,2002,2007-2009 Alain Knaff. |
| 2 | * This file is part of mtools. |
| 3 | * |
| 4 | * Mtools is free software: you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License as published by |
| 6 | * the Free Software Foundation, either version 3 of the License, or |
| 7 | * (at your option) any later version. |
| 8 | * |
| 9 | * Mtools is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with Mtools. If not, see <http://www.gnu.org/licenses/>. |
| 16 | * |
| 17 | * System includes for mtools |
| 18 | */ |
| 19 | |
| 20 | #ifndef SYSINCLUDES_H |
| 21 | #define SYSINCLUDES_H |
| 22 | |
Alistair Delva | beaee83 | 2021-02-24 11:27:23 -0800 | [diff] [blame] | 23 | #define _GNU_SOURCE |
| 24 | |
| 25 | #include "config.h" |
| 26 | |
| 27 | |
| 28 | /* OS/2 needs __inline__, but for some reason is not autodetected */ |
| 29 | #ifdef __EMX__ |
| 30 | # ifndef inline |
| 31 | # define inline __inline__ |
| 32 | # endif |
| 33 | #endif |
| 34 | |
| 35 | /***********************************************************************/ |
| 36 | /* */ |
| 37 | /* OS dependencies which cannot be covered by the autoconfigure script */ |
| 38 | /* */ |
| 39 | /***********************************************************************/ |
| 40 | |
| 41 | |
| 42 | #ifdef OS_aux |
| 43 | /* A/UX needs POSIX_SOURCE, just as AIX does. Unlike SCO and AIX, it seems |
| 44 | * to prefer TERMIO over TERMIOS */ |
| 45 | #ifndef _POSIX_SOURCE |
| 46 | # define _POSIX_SOURCE |
| 47 | #endif |
| 48 | #ifndef POSIX_SOURCE |
| 49 | # define POSIX_SOURCE |
| 50 | #endif |
| 51 | |
| 52 | #endif |
| 53 | |
| 54 | |
Yi Kong | 39bbd96 | 2022-01-09 19:41:38 +0800 | [diff] [blame] | 55 | /* On AIX, we have to prefer strings.h, as string.h lacks a prototype |
| 56 | * for strcasecmp. On Solaris, string.h lacks a prototype for strncasecmp_l. |
| 57 | * On most other architectures, it's string.h which seems to be more complete */ |
| 58 | #if ((defined OS_aix || defined OS_solaris) && defined HAVE_STRINGS_H) |
Alistair Delva | beaee83 | 2021-02-24 11:27:23 -0800 | [diff] [blame] | 59 | # undef HAVE_STRING_H |
| 60 | #endif |
| 61 | |
| 62 | |
| 63 | #ifdef OS_ultrix |
| 64 | /* on ultrix, if termios present, prefer it instead of termio */ |
| 65 | # ifdef HAVE_TERMIOS_H |
| 66 | # undef HAVE_TERMIO_H |
| 67 | # endif |
| 68 | #endif |
| 69 | |
| 70 | #ifdef OS_linux_gnu |
| 71 | /* RMS strikes again */ |
| 72 | # ifndef OS_linux |
| 73 | # define OS_linux |
| 74 | # endif |
| 75 | #endif |
| 76 | |
| 77 | /* For compiling with MingW, use the following configure line |
| 78 | |
| 79 | ac_cv_func_setpgrp_void=yes ../mtools/configure --build=i386-linux-gnu --host=i386-mingw32 --disable-floppyd --without-x --disable-raw-term --srcdir ../mtools |
| 80 | |
| 81 | */ |
| 82 | #ifdef OS_mingw32 |
| 83 | #ifndef OS_mingw32msvc |
| 84 | #define OS_mingw32msvc |
| 85 | #endif |
| 86 | #endif |
| 87 | |
| 88 | #ifndef HAVE_CADDR_T |
| 89 | typedef void *caddr_t; |
| 90 | #endif |
| 91 | |
| 92 | |
| 93 | /***********************************************************************/ |
| 94 | /* */ |
| 95 | /* Compiler dependencies */ |
| 96 | /* */ |
| 97 | /***********************************************************************/ |
| 98 | |
| 99 | |
| 100 | #if defined __GNUC__ && defined __STDC__ |
| 101 | /* gcc -traditional doesn't have PACKED, UNUSED and NORETURN */ |
| 102 | # define PACKED __attribute__ ((packed)) |
| 103 | # if __GNUC__ == 2 && __GNUC_MINOR__ > 6 || __GNUC__ >= 3 |
| 104 | /* gcc 2.6.3 doesn't have "unused" */ /* mool */ |
| 105 | # define UNUSED(x) x __attribute__ ((unused));x |
| 106 | # define UNUSEDP __attribute__ ((unused)) |
| 107 | # endif |
| 108 | # define NORETURN __attribute__ ((noreturn)) |
| 109 | # if __GNUC__ >= 8 |
| 110 | # define NONULLTERM __attribute__ ((nonstring)) |
| 111 | # endif |
| 112 | #endif |
| 113 | |
| 114 | #ifndef UNUSED |
| 115 | # define UNUSED(x) x |
| 116 | # define UNUSEDP /* */ |
| 117 | #endif |
| 118 | |
| 119 | #ifndef PACKED |
| 120 | # define PACKED /* */ |
| 121 | #endif |
| 122 | |
| 123 | #ifndef NORETURN |
| 124 | # define NORETURN /* */ |
| 125 | #endif |
| 126 | |
| 127 | #ifndef NONULLTERM |
| 128 | # define NONULLTERM /* */ |
| 129 | #endif |
| 130 | |
| 131 | /***********************************************************************/ |
| 132 | /* */ |
| 133 | /* Include files */ |
| 134 | /* */ |
| 135 | /***********************************************************************/ |
| 136 | |
Yi Kong | 39bbd96 | 2022-01-09 19:41:38 +0800 | [diff] [blame] | 137 | #ifdef HAVE_ASSERT_H |
| 138 | # include <assert.h> |
| 139 | #endif |
Alistair Delva | beaee83 | 2021-02-24 11:27:23 -0800 | [diff] [blame] | 140 | |
| 141 | #ifdef HAVE_FEATURES_H |
| 142 | # include <features.h> |
| 143 | #endif |
| 144 | |
| 145 | |
| 146 | #include <sys/types.h> |
| 147 | |
| 148 | #ifdef HAVE_STDINT_H |
| 149 | # include <stdint.h> |
| 150 | #endif |
| 151 | |
Yi Kong | 39bbd96 | 2022-01-09 19:41:38 +0800 | [diff] [blame] | 152 | #ifdef HAVE_STDARG_H |
| 153 | # include <stdarg.h> |
| 154 | #endif |
| 155 | |
| 156 | #if HAVE_STDBOOL_H |
| 157 | # include <stdbool.h> |
| 158 | #else |
| 159 | # if ! HAVE__BOOL |
| 160 | # ifdef __cplusplus |
| 161 | typedef bool _Bool; |
| 162 | # else |
| 163 | typedef unsigned char _Bool; |
| 164 | # endif |
| 165 | # endif |
| 166 | # define bool _Bool |
| 167 | # define false 0 |
| 168 | # define true 1 |
| 169 | # define __bool_true_false_are_defined 1 |
| 170 | #endif |
| 171 | |
Alistair Delva | beaee83 | 2021-02-24 11:27:23 -0800 | [diff] [blame] | 172 | #ifdef HAVE_INTTYPES_H |
| 173 | # include <inttypes.h> |
| 174 | #endif |
| 175 | |
| 176 | #ifdef HAVE_STDLIB_H |
| 177 | # include <stdlib.h> |
| 178 | #endif |
| 179 | |
| 180 | #include <stdio.h> |
| 181 | #include <ctype.h> |
| 182 | |
| 183 | #ifdef HAVE_UNISTD_H |
| 184 | # include <unistd.h> |
| 185 | #endif |
| 186 | |
| 187 | #ifdef HAVE_LINUX_UNISTD_H |
| 188 | # include <linux/unistd.h> |
| 189 | #endif |
| 190 | |
| 191 | #ifdef HAVE_LIBC_H |
| 192 | # include <libc.h> |
| 193 | #endif |
| 194 | |
| 195 | #ifdef HAVE_GETOPT_H |
| 196 | # include <getopt.h> |
| 197 | #endif |
| 198 | |
| 199 | #ifdef HAVE_FCNTL_H |
| 200 | # include <fcntl.h> |
| 201 | #endif |
| 202 | |
| 203 | #ifdef HAVE_LIMITS_H |
| 204 | # include <limits.h> |
| 205 | #endif |
| 206 | |
| 207 | #ifdef HAVE_SYS_FILE_H |
| 208 | # include <sys/file.h> |
| 209 | #endif |
| 210 | |
| 211 | #ifdef HAVE_SYS_IOCTL_H |
| 212 | # ifndef sunos |
| 213 | # include <sys/ioctl.h> |
| 214 | #endif |
| 215 | #endif |
| 216 | /* if we don't have sys/ioctl.h, we rely on unistd to supply a prototype |
| 217 | * for it. If it doesn't, we'll only get a (harmless) warning. The idea |
| 218 | * is to get mtools compile on as many platforms as possible, but to not |
| 219 | * suppress warnings if the platform is broken, as long as these warnings do |
| 220 | * not prevent compilation */ |
| 221 | |
| 222 | #ifdef TIME_WITH_SYS_TIME |
| 223 | # include <sys/time.h> |
| 224 | # include <time.h> |
| 225 | #else |
| 226 | # ifdef HAVE_SYS_TIME_H |
| 227 | # include <sys/time.h> |
| 228 | # else |
| 229 | # include <time.h> |
| 230 | # endif |
| 231 | #endif |
| 232 | |
| 233 | #ifndef NO_TERMIO |
| 234 | # ifdef HAVE_TERMIO_H |
| 235 | # include <termio.h> |
| 236 | # elif defined HAVE_SYS_TERMIO_H |
| 237 | # include <sys/termio.h> |
| 238 | # endif |
| 239 | # if !defined OS_ultrix || !(defined HAVE_TERMIO_H || defined HAVE_TERMIO_H) |
| 240 | /* on Ultrix, avoid double inclusion of both termio and termios */ |
| 241 | # ifdef HAVE_TERMIOS_H |
| 242 | # include <termios.h> |
| 243 | # elif defined HAVE_SYS_TERMIOS_H |
| 244 | # include <sys/termios.h> |
| 245 | # endif |
| 246 | # endif |
| 247 | # ifdef HAVE_STTY_H |
| 248 | # include <sgtty.h> |
| 249 | # endif |
| 250 | #endif |
| 251 | |
| 252 | |
| 253 | #if defined(OS_aux) && !defined(_SYSV_SOURCE) |
| 254 | /* compiled in POSIX mode, this is left out unless SYSV */ |
| 255 | #define NCC 8 |
| 256 | struct termio { |
| 257 | unsigned short c_iflag; /* input modes */ |
| 258 | unsigned short c_oflag; /* output modes */ |
| 259 | unsigned short c_cflag; /* control modes */ |
| 260 | unsigned short c_lflag; /* line discipline modes */ |
| 261 | char c_line; /* line discipline */ |
| 262 | unsigned char c_cc[NCC]; /* control chars */ |
| 263 | }; |
| 264 | extern int ioctl(int fildes, int request, void *arg); |
| 265 | #endif |
| 266 | |
| 267 | |
| 268 | #ifdef HAVE_MNTENT_H |
| 269 | # include <mntent.h> |
| 270 | #endif |
| 271 | |
| 272 | #ifdef HAVE_SYS_PARAM_H |
| 273 | # include <sys/param.h> |
| 274 | #endif |
| 275 | |
| 276 | /* Can only be done here, as BSD is defined in sys/param.h :-( */ |
| 277 | #if defined BSD || defined __BEOS__ |
| 278 | /* on BSD and on BEOS, we prefer gettimeofday, ... */ |
| 279 | # ifdef HAVE_GETTIMEOFDAY |
| 280 | # undef HAVE_TZSET |
| 281 | # endif |
| 282 | #else /* BSD */ |
| 283 | /* ... elsewhere we prefer tzset */ |
| 284 | # ifdef HAVE_TZSET |
| 285 | # undef HAVE_GETTIMEOFDAY |
| 286 | # endif |
| 287 | #endif |
| 288 | |
| 289 | |
| 290 | #include <sys/stat.h> |
| 291 | |
| 292 | #include <errno.h> |
| 293 | #ifndef errno |
| 294 | extern int errno; |
| 295 | #endif |
| 296 | |
| 297 | #ifndef OS_mingw32msvc |
| 298 | #include <pwd.h> |
| 299 | #endif |
| 300 | |
| 301 | |
| 302 | #ifdef HAVE_STRING_H |
| 303 | # include <string.h> |
| 304 | #else |
| 305 | # ifdef HAVE_STRINGS_H |
| 306 | # include <strings.h> |
| 307 | # endif |
| 308 | #endif |
| 309 | |
| 310 | #ifdef HAVE_MEMORY_H |
| 311 | # include <memory.h> |
| 312 | #endif |
| 313 | |
| 314 | #ifdef HAVE_MALLOC_H |
| 315 | # include <malloc.h> |
| 316 | #endif |
| 317 | |
| 318 | #ifdef HAVE_IO_H |
| 319 | # include <io.h> |
| 320 | #endif |
| 321 | |
| 322 | #ifdef HAVE_SIGNAL_H |
| 323 | # include <signal.h> |
| 324 | #else |
| 325 | # ifdef HAVE_SYS_SIGNAL_H |
| 326 | # include <sys/signal.h> |
| 327 | # endif |
| 328 | #endif |
| 329 | |
| 330 | #ifdef HAVE_UTIME_H |
| 331 | # include <utime.h> |
| 332 | #endif |
| 333 | |
| 334 | #ifdef HAVE_SYS_WAIT_H |
| 335 | # ifndef DONT_NEED_WAIT |
| 336 | # include <sys/wait.h> |
| 337 | # endif |
| 338 | #endif |
| 339 | |
| 340 | #ifdef HAVE_WCHAR_H |
| 341 | # include <wchar.h> |
| 342 | # ifndef HAVE_PUTWC |
| 343 | # define putwc(c,f) fprintf((f),"%lc",(c)) |
| 344 | # endif |
| 345 | #else |
| 346 | # define wcscmp strcmp |
| 347 | # define wcscasecmp strcasecmp |
| 348 | # define wcsdup strdup |
| 349 | # define wcslen strlen |
| 350 | # define wcschr strchr |
| 351 | # define wcspbrk strpbrk |
| 352 | # define wchar_t char |
| 353 | # define putwc putc |
| 354 | #endif |
| 355 | |
| 356 | #ifdef HAVE_WCTYPE_H |
| 357 | # include <wctype.h> |
| 358 | #else |
| 359 | # define towupper(x) toupper(x) |
| 360 | # define towlower(x) tolower(x) |
| 361 | # define iswupper(x) isupper(x) |
| 362 | # define iswlower(x) islower(x) |
| 363 | # define iswcntrl(x) iscntrl(x) |
| 364 | #endif |
| 365 | |
| 366 | #ifdef HAVE_LOCALE_H |
| 367 | # include <locale.h> |
| 368 | #endif |
| 369 | |
| 370 | #ifdef HAVE_XLOCALE_H |
| 371 | # include <xlocale.h> |
| 372 | #endif |
| 373 | |
| 374 | #ifdef USE_FLOPPYD |
| 375 | |
| 376 | #ifdef HAVE_SYS_SOCKET_H |
| 377 | #include <sys/socket.h> |
| 378 | #endif |
| 379 | |
| 380 | #ifdef HAVE_NETINET_IN_H |
| 381 | #include <netinet/in.h> |
| 382 | #endif |
| 383 | |
| 384 | #ifdef HAVE_NETINET_TCP_H |
| 385 | #include <netinet/tcp.h> |
| 386 | #endif |
| 387 | |
| 388 | #ifdef HAVE_ARPA_INET_H |
| 389 | #include <arpa/inet.h> |
| 390 | #endif |
| 391 | |
| 392 | #ifdef HAVE_NETDB_H |
| 393 | #include <netdb.h> |
| 394 | #endif |
| 395 | |
| 396 | #ifdef HAVE_X11_XAUTH_H |
| 397 | #include <X11/Xauth.h> |
| 398 | #endif |
| 399 | |
| 400 | #ifdef HAVE_X11_XLIB_H |
| 401 | #include <X11/Xlib.h> |
| 402 | #endif |
| 403 | |
| 404 | #endif |
| 405 | |
| 406 | #ifndef INADDR_NONE |
| 407 | #define INADDR_NONE (-1) |
| 408 | #endif |
| 409 | |
| 410 | |
| 411 | #ifdef sgi |
| 412 | #define MSGIHACK __EXTENSIONS__ |
| 413 | #undef __EXTENSIONS__ |
| 414 | #endif |
| 415 | #include <math.h> |
| 416 | #ifdef sgi |
| 417 | #define __EXTENSIONS__ MSGIHACK |
| 418 | #undef MSGIHACK |
| 419 | #endif |
| 420 | |
| 421 | /* missing functions */ |
| 422 | #ifndef HAVE_SRANDOM |
| 423 | # ifdef OS_mingw32msvc |
| 424 | # define srandom srand |
| 425 | # else |
| 426 | # define srandom srand48 |
| 427 | # endif |
| 428 | #endif |
| 429 | |
| 430 | #ifndef HAVE_RANDOM |
| 431 | # ifdef OS_mingw32msvc |
| 432 | # define random (long)rand |
| 433 | # else |
| 434 | # define random (long)lrand48 |
| 435 | # endif |
| 436 | #endif |
| 437 | |
| 438 | #ifndef HAVE_STRCHR |
| 439 | # define strchr index |
| 440 | #endif |
| 441 | |
| 442 | #ifndef HAVE_STRRCHR |
| 443 | # define strrchr rindex |
| 444 | #endif |
| 445 | |
| 446 | |
| 447 | #ifndef HAVE_STRDUP |
| 448 | extern char *strdup(const char *str); |
| 449 | #endif /* HAVE_STRDUP */ |
| 450 | |
| 451 | #ifndef HAVE_STRNDUP |
| 452 | extern char *strndup(const char *s, size_t n); |
| 453 | #endif /* HAVE_STRDUP */ |
| 454 | |
| 455 | #ifndef HAVE_MEMCPY |
| 456 | extern char *memcpy(char *s1, const char *s2, size_t n); |
| 457 | #endif |
| 458 | |
| 459 | #ifndef HAVE_MEMSET |
| 460 | extern char *memset(char *s, char c, size_t n); |
| 461 | #endif /* HAVE_MEMSET */ |
| 462 | |
| 463 | |
| 464 | #ifndef HAVE_STRPBRK |
| 465 | extern char *strpbrk(const char *string, const char *brkset); |
| 466 | #endif /* HAVE_STRPBRK */ |
| 467 | |
| 468 | |
| 469 | #ifndef HAVE_STRTOUL |
| 470 | unsigned long strtoul(const char *string, char **eptr, int base); |
| 471 | #endif /* HAVE_STRTOUL */ |
| 472 | |
| 473 | #ifndef HAVE_STRSPN |
| 474 | size_t strspn(const char *s, const char *accept); |
| 475 | #endif /* HAVE_STRSPN */ |
| 476 | |
| 477 | #ifndef HAVE_STRCSPN |
| 478 | size_t strcspn(const char *s, const char *reject); |
| 479 | #endif /* HAVE_STRCSPN */ |
| 480 | |
| 481 | #ifndef HAVE_STRERROR |
| 482 | char *strerror(int errno); |
| 483 | #endif |
| 484 | |
| 485 | #ifndef HAVE_ATEXIT |
Yi Kong | 39bbd96 | 2022-01-09 19:41:38 +0800 | [diff] [blame] | 486 | int atexit(void (*function)(void)); |
Alistair Delva | beaee83 | 2021-02-24 11:27:23 -0800 | [diff] [blame] | 487 | |
| 488 | #ifndef HAVE_ON_EXIT |
| 489 | void myexit(int code) NORETURN; |
| 490 | #define exit myexit |
| 491 | #endif |
| 492 | |
| 493 | #endif |
| 494 | |
| 495 | |
| 496 | #ifndef HAVE_MEMMOVE |
| 497 | # define memmove(DST, SRC, N) bcopy(SRC, DST, N) |
| 498 | #endif |
| 499 | |
| 500 | #ifndef HAVE_STRCASECMP |
| 501 | int strcasecmp(const char *s1, const char *s2); |
| 502 | #endif |
| 503 | |
| 504 | #ifndef HAVE_STRNCASECMP |
| 505 | int strncasecmp(const char *s1, const char *s2, size_t n); |
| 506 | #endif |
| 507 | |
| 508 | #ifndef HAVE_GETPASS |
| 509 | char *getpass(const char *prompt); |
| 510 | #endif |
| 511 | |
| 512 | #ifdef HAVE_WCHAR_H |
| 513 | |
| 514 | # ifndef HAVE_WCSDUP |
| 515 | wchar_t *wcsdup(const wchar_t *wcs); |
| 516 | # endif |
| 517 | |
| 518 | # ifndef HAVE_WCSCASECMP |
| 519 | int wcscasecmp(const wchar_t *s1, const wchar_t *s2); |
| 520 | # endif |
| 521 | |
| 522 | # ifndef HAVE_WCSNLEN |
| 523 | size_t wcsnlen(const wchar_t *wcs, size_t l); |
| 524 | # endif |
| 525 | |
| 526 | #endif |
| 527 | |
| 528 | #if 0 |
| 529 | #ifndef HAVE_BASENAME |
| 530 | const char *basename(const char *filename); |
| 531 | #endif |
| 532 | #endif |
| 533 | |
| 534 | const char *_basename(const char *filename); |
| 535 | |
| 536 | void _stripexe(char *filename); |
| 537 | |
| 538 | #ifndef __STDC__ |
| 539 | # ifndef signed |
| 540 | # define signed /**/ |
Yi Kong | 39bbd96 | 2022-01-09 19:41:38 +0800 | [diff] [blame] | 541 | # endif |
Alistair Delva | beaee83 | 2021-02-24 11:27:23 -0800 | [diff] [blame] | 542 | #endif /* !__STDC__ */ |
| 543 | |
| 544 | |
| 545 | |
| 546 | /***************************************************************************/ |
| 547 | /* */ |
| 548 | /* Prototypes for systems where the functions exist but not the prototypes */ |
| 549 | /* */ |
| 550 | /***************************************************************************/ |
| 551 | |
| 552 | |
| 553 | |
| 554 | /* prototypes which might be missing on some platforms, even if the functions |
| 555 | * are present. Do not declare argument types, in order to avoid conflict |
| 556 | * on platforms where the prototypes _are_ correct. Indeed, for most of |
| 557 | * these, there are _several_ "correct" parameter definitions, and not all |
| 558 | * platforms use the same. For instance, some use the const attribute for |
| 559 | * strings not modified by the function, and others do not. By using just |
| 560 | * the return type, which rarely changes, we avoid these problems. |
| 561 | */ |
| 562 | |
| 563 | /* Correction: Now it seems that even return values are not standardized :-( |
| 564 | For instance DEC-ALPHA, OSF/1 3.2d uses ssize_t as a return type for read |
| 565 | and write. NextStep uses a non-void return value for exit, etc. With the |
| 566 | advent of 64 bit system, we'll expect more of these problems in the future. |
| 567 | Better uncomment the lot, except on SunOS, which is known to have bad |
| 568 | incomplete files. Add other OS'es with incomplete include files as needed |
| 569 | */ |
| 570 | #if (defined OS_sunos || defined OS_ultrix) |
| 571 | int read(); |
| 572 | int write(); |
| 573 | int fflush(); |
| 574 | char *strdup(); |
| 575 | int strcasecmp(); |
| 576 | int strncasecmp(); |
| 577 | char *getenv(); |
| 578 | unsigned long strtoul(); |
| 579 | int pclose(); |
| 580 | void exit(); |
| 581 | char *getpass(); |
| 582 | int atoi(); |
| 583 | FILE *fdopen(); |
| 584 | FILE *popen(); |
| 585 | #endif |
| 586 | |
| 587 | #ifndef MAXPATHLEN |
| 588 | # ifdef PATH_MAX |
| 589 | # define MAXPATHLEN PATH_MAX |
| 590 | # else |
| 591 | # define MAXPATHLEN 1024 |
| 592 | # endif |
| 593 | #endif |
| 594 | |
| 595 | |
| 596 | #ifndef OS_linux |
| 597 | # undef USE_XDF |
| 598 | #endif |
| 599 | |
| 600 | #ifdef NO_XDF |
| 601 | # undef USE_XDF |
| 602 | #endif |
| 603 | |
| 604 | #ifdef __EMX__ |
| 605 | #define INCL_BASE |
| 606 | #define INCL_DOSDEVIOCTL |
| 607 | #include <os2.h> |
| 608 | #endif |
| 609 | |
| 610 | #ifdef OS_nextstep |
| 611 | /* nextstep doesn't have this. Unfortunately, we cannot test its presence |
| 612 | using AC_EGREP_HEADER, as we don't know _which_ header to test, and in |
| 613 | the general case utime.h might be non-existent */ |
| 614 | struct utimbuf |
| 615 | { |
| 616 | time_t actime,modtime; |
| 617 | }; |
| 618 | #endif |
| 619 | |
| 620 | /* NeXTStep doesn't have these */ |
| 621 | #if !defined(S_ISREG) && defined (_S_IFMT) && defined (_S_IFREG) |
| 622 | #define S_ISREG(mode) (((mode) & (_S_IFMT)) == (_S_IFREG)) |
| 623 | #endif |
| 624 | |
| 625 | #if !defined(S_ISDIR) && defined (_S_IFMT) && defined (_S_IFDIR) |
| 626 | #define S_ISDIR(mode) (((mode) & (_S_IFMT)) == (_S_IFDIR)) |
| 627 | #endif |
| 628 | |
| 629 | |
| 630 | #ifdef OS_aix |
| 631 | /* AIX has an offset_t time, but somehow it is not scalar ==> forget about it |
| 632 | */ |
| 633 | # undef HAVE_OFFSET_T |
| 634 | #endif |
| 635 | |
| 636 | |
| 637 | #ifdef HAVE_STAT64 |
| 638 | #define MT_STAT stat64 |
| 639 | #define MT_LSTAT lstat64 |
| 640 | #define MT_FSTAT fstat64 |
| 641 | #else |
| 642 | #define MT_STAT stat |
| 643 | #define MT_LSTAT lstat |
| 644 | #define MT_FSTAT fstat |
| 645 | #endif |
| 646 | |
| 647 | |
| 648 | #ifndef O_LARGEFILE |
| 649 | #define O_LARGEFILE 0 |
| 650 | #endif |
| 651 | |
| 652 | #ifndef __GNUC__ |
| 653 | #ifndef __inline__ |
| 654 | #define __inline__ inline |
| 655 | #endif |
| 656 | #endif |
| 657 | |
| 658 | #endif |