dos.m4 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #serial 9
  2. # Define some macros required for proper operation of code in lib/*.c
  3. # on MSDOS/Windows systems.
  4. # Copyright (C) 2000, 2001, 2004 Free Software Foundation, Inc.
  5. # This file is free software; the Free Software Foundation
  6. # gives unlimited permission to copy and/or distribute it,
  7. # with or without modifications, as long as this notice is preserved.
  8. # From Jim Meyering.
  9. AC_DEFUN([gl_AC_DOS],
  10. [
  11. AC_CACHE_CHECK([whether system is Windows or MSDOS], [ac_cv_win_or_dos],
  12. [
  13. AC_TRY_COMPILE([],
  14. [#if !defined _WIN32 && !defined __WIN32__ && !defined __MSDOS__ && !defined __CYGWIN__
  15. neither MSDOS nor Windows
  16. #endif],
  17. [ac_cv_win_or_dos=yes],
  18. [ac_cv_win_or_dos=no])
  19. ])
  20. if test x"$ac_cv_win_or_dos" = xyes; then
  21. ac_fs_accepts_drive_letter_prefix=1
  22. ac_fs_backslash_is_file_name_separator=1
  23. else
  24. ac_fs_accepts_drive_letter_prefix=0
  25. ac_fs_backslash_is_file_name_separator=0
  26. fi
  27. AH_VERBATIM(FILE_SYSTEM_PREFIX_LEN,
  28. [#if FILE_SYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX
  29. # define FILE_SYSTEM_PREFIX_LEN(Filename) \
  30. ((Filename)[0] && (Filename)[1] == ':' ? 2 : 0)
  31. #else
  32. # define FILE_SYSTEM_PREFIX_LEN(Filename) 0
  33. #endif])
  34. AC_DEFINE_UNQUOTED([FILE_SYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX],
  35. $ac_fs_accepts_drive_letter_prefix,
  36. [Define on systems for which file names may have a so-called
  37. `drive letter' prefix, define this to compute the length of that
  38. prefix, including the colon.])
  39. AH_VERBATIM(ISSLASH,
  40. [#if FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR
  41. # define ISSLASH(C) ((C) == '/' || (C) == '\\')
  42. #else
  43. # define ISSLASH(C) ((C) == '/')
  44. #endif])
  45. AC_DEFINE_UNQUOTED([FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR],
  46. $ac_fs_backslash_is_file_name_separator,
  47. [Define if the backslash character may also serve as a file name
  48. component separator.])
  49. ])