Provide a return value for unsetenv() if the system doesn't.
[gnulib.git] / m4 / dos.m4
1 #serial 8
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
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2, or (at your option)
11 # any later version.
12
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 # GNU General Public License for more details.
17
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
21 # 02111-1307, USA.
22
23 # From Jim Meyering.
24
25 AC_DEFUN([gl_AC_DOS],
26   [
27     AC_CACHE_CHECK([whether system is Windows or MSDOS], [ac_cv_win_or_dos],
28       [
29         AC_TRY_COMPILE([],
30         [#if !defined _WIN32 && !defined __WIN32__ && !defined __MSDOS__ && !defined __CYGWIN__
31 neither MSDOS nor Windows
32 #endif],
33         [ac_cv_win_or_dos=yes],
34         [ac_cv_win_or_dos=no])
35       ])
36
37     if test x"$ac_cv_win_or_dos" = xyes; then
38       ac_fs_accepts_drive_letter_prefix=1
39       ac_fs_backslash_is_file_name_separator=1
40     else
41       ac_fs_accepts_drive_letter_prefix=0
42       ac_fs_backslash_is_file_name_separator=0
43     fi
44
45     AH_VERBATIM(FILE_SYSTEM_PREFIX_LEN,
46     [#if FILE_SYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX
47 # define FILE_SYSTEM_PREFIX_LEN(Filename) \
48   ((Filename)[0] && (Filename)[1] == ':' ? 2 : 0)
49 #else
50 # define FILE_SYSTEM_PREFIX_LEN(Filename) 0
51 #endif])
52
53     AC_DEFINE_UNQUOTED([FILE_SYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX],
54       $ac_fs_accepts_drive_letter_prefix,
55       [Define on systems for which file names may have a so-called
56        `drive letter' prefix, define this to compute the length of that
57        prefix, including the colon.])
58
59     AH_VERBATIM(ISSLASH,
60     [#if FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR
61 # define ISSLASH(C) ((C) == '/' || (C) == '\\')
62 #else
63 # define ISSLASH(C) ((C) == '/')
64 #endif])
65
66     AC_DEFINE_UNQUOTED([FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR],
67       $ac_fs_backslash_is_file_name_separator,
68       [Define if the backslash character may also serve as a file name
69        component separator.])
70   ])