]> git.saurik.com Git - bison.git/blob - m4/dos.m4
* doc/bison.texinfo (Strings are Destroyed): s/losses/loses/.
[bison.git] / m4 / dos.m4
1 #serial 5
2
3 # Define some macros required for proper operation of code in lib/*.c
4 # on MSDOS/Windows systems.
5
6 # From Jim Meyering.
7
8 AC_DEFUN([jm_AC_DOS],
9 [
10 AC_CACHE_CHECK([whether system is Windows or MSDOS], [ac_cv_win_or_dos],
11 [
12 AC_TRY_COMPILE([],
13 [#if !defined _WIN32 && !defined __WIN32__ && !defined __MSDOS__
14 neither MSDOS nor Windows
15 #endif],
16 [ac_cv_win_or_dos=yes],
17 [ac_cv_win_or_dos=no])
18 ])
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
28 AH_VERBATIM(FILESYSTEM_PREFIX_LEN,
29 [#if FILESYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX
30 # define FILESYSTEM_PREFIX_LEN(Filename) \
31 ((Filename)[0] && (Filename)[1] == ':' ? 2 : 0)
32 #else
33 # define FILESYSTEM_PREFIX_LEN(Filename) 0
34 #endif])
35
36 AC_DEFINE_UNQUOTED([FILESYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX],
37 $ac_fs_accepts_drive_letter_prefix,
38 [Define on systems for which file names may have a so-called
39 `drive letter' prefix, define this to compute the length of that
40 prefix, including the colon.])
41
42 AH_VERBATIM(ISSLASH,
43 [#if FILESYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR
44 # define ISSLASH(C) ((C) == '/' || (C) == '\\')
45 #else
46 # define ISSLASH(C) ((C) == '/')
47 #endif])
48
49 AC_DEFINE_UNQUOTED([FILESYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR],
50 $ac_fs_backslash_is_file_name_separator,
51 [Define if the backslash character may also serve as a file name
52 component separator.])
53 ])