summaryrefslogtreecommitdiffstats
path: root/gl/m4/dos.m4
diff options
context:
space:
mode:
Diffstat (limited to 'gl/m4/dos.m4')
-rw-r--r--gl/m4/dos.m471
1 files changed, 71 insertions, 0 deletions
diff --git a/gl/m4/dos.m4 b/gl/m4/dos.m4
new file mode 100644
index 00000000..dd59571c
--- /dev/null
+++ b/gl/m4/dos.m4
@@ -0,0 +1,71 @@
1#serial 10 -*- autoconf -*-
2
3# Define some macros required for proper operation of code in lib/*.c
4# on MSDOS/Windows systems.
5
6# Copyright (C) 2000, 2001, 2004, 2005, 2006 Free Software Foundation, Inc.
7# This file is free software; the Free Software Foundation
8# gives unlimited permission to copy and/or distribute it,
9# with or without modifications, as long as this notice is preserved.
10
11# From Jim Meyering.
12
13AC_DEFUN([gl_AC_DOS],
14 [
15 AC_CACHE_CHECK([whether system is Windows or MSDOS], [ac_cv_win_or_dos],
16 [
17 AC_TRY_COMPILE([],
18 [#if !defined _WIN32 && !defined __WIN32__ && !defined __MSDOS__ && !defined __CYGWIN__
19neither MSDOS nor Windows
20#endif],
21 [ac_cv_win_or_dos=yes],
22 [ac_cv_win_or_dos=no])
23 ])
24
25 if test x"$ac_cv_win_or_dos" = xyes; then
26 ac_fs_accepts_drive_letter_prefix=1
27 ac_fs_backslash_is_file_name_separator=1
28 AC_CACHE_CHECK([whether drive letter can start relative path],
29 [ac_cv_drive_letter_can_be_relative],
30 [
31 AC_TRY_COMPILE([],
32 [#if defined __CYGWIN__
33drive letters are always absolute
34#endif],
35 [ac_cv_drive_letter_can_be_relative=yes],
36 [ac_cv_drive_letter_can_be_relative=no])
37 ])
38 if test x"$ac_cv_drive_letter_can_be_relative" = xyes; then
39 ac_fs_drive_letter_can_be_relative=1
40 else
41 ac_fs_drive_letter_can_be_relative=0
42 fi
43 else
44 ac_fs_accepts_drive_letter_prefix=0
45 ac_fs_backslash_is_file_name_separator=0
46 ac_fs_drive_letter_can_be_relative=0
47 fi
48
49 AC_DEFINE_UNQUOTED([FILE_SYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX],
50 $ac_fs_accepts_drive_letter_prefix,
51 [Define on systems for which file names may have a so-called
52 `drive letter' prefix, define this to compute the length of that
53 prefix, including the colon.])
54
55 AH_VERBATIM(ISSLASH,
56 [#if FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR
57# define ISSLASH(C) ((C) == '/' || (C) == '\\')
58#else
59# define ISSLASH(C) ((C) == '/')
60#endif])
61
62 AC_DEFINE_UNQUOTED([FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR],
63 $ac_fs_backslash_is_file_name_separator,
64 [Define if the backslash character may also serve as a file name
65 component separator.])
66
67 AC_DEFINE_UNQUOTED([FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE],
68 $ac_fs_drive_letter_can_be_relative,
69 [Define if a drive letter prefix denotes a relative path if it is
70 not followed by a file name component separator.])
71 ])