dos.m4 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #serial 11 -*- autoconf -*-
  2. # Define some macros required for proper operation of code in lib/*.c
  3. # on MSDOS/Windows systems.
  4. # Copyright (C) 2000-2001, 2004-2006, 2009-2010 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_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
  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. AC_CACHE_CHECK([whether drive letter can start relative path],
  24. [ac_cv_drive_letter_can_be_relative],
  25. [
  26. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
  27. #if defined __CYGWIN__
  28. drive letters are always absolute
  29. #endif]])],
  30. [ac_cv_drive_letter_can_be_relative=yes],
  31. [ac_cv_drive_letter_can_be_relative=no])
  32. ])
  33. if test x"$ac_cv_drive_letter_can_be_relative" = xyes; then
  34. ac_fs_drive_letter_can_be_relative=1
  35. else
  36. ac_fs_drive_letter_can_be_relative=0
  37. fi
  38. else
  39. ac_fs_accepts_drive_letter_prefix=0
  40. ac_fs_backslash_is_file_name_separator=0
  41. ac_fs_drive_letter_can_be_relative=0
  42. fi
  43. AC_DEFINE_UNQUOTED([FILE_SYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX],
  44. $ac_fs_accepts_drive_letter_prefix,
  45. [Define on systems for which file names may have a so-called
  46. `drive letter' prefix, define this to compute the length of that
  47. prefix, including the colon.])
  48. AH_VERBATIM(ISSLASH,
  49. [#if FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR
  50. # define ISSLASH(C) ((C) == '/' || (C) == '\\')
  51. #else
  52. # define ISSLASH(C) ((C) == '/')
  53. #endif])
  54. AC_DEFINE_UNQUOTED([FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR],
  55. $ac_fs_backslash_is_file_name_separator,
  56. [Define if the backslash character may also serve as a file name
  57. component separator.])
  58. AC_DEFINE_UNQUOTED([FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE],
  59. $ac_fs_drive_letter_can_be_relative,
  60. [Define if a drive letter prefix denotes a relative path if it is
  61. not followed by a file name component separator.])
  62. ])