1#serial 9
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 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    else
29      ac_fs_accepts_drive_letter_prefix=0
30      ac_fs_backslash_is_file_name_separator=0
31    fi
32
33    AH_VERBATIM(FILE_SYSTEM_PREFIX_LEN,
34    [#if FILE_SYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX
35# define FILE_SYSTEM_PREFIX_LEN(Filename) \
36  ((Filename)[0] && (Filename)[1] == ':' ? 2 : 0)
37#else
38# define FILE_SYSTEM_PREFIX_LEN(Filename) 0
39#endif])
40
41    AC_DEFINE_UNQUOTED([FILE_SYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX],
42      $ac_fs_accepts_drive_letter_prefix,
43      [Define on systems for which file names may have a so-called
44       `drive letter' prefix, define this to compute the length of that
45       prefix, including the colon.])
46
47    AH_VERBATIM(ISSLASH,
48    [#if FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR
49# define ISSLASH(C) ((C) == '/' || (C) == '\\')
50#else
51# define ISSLASH(C) ((C) == '/')
52#endif])
53
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  ])
59