diff options
| -rw-r--r-- | ChangeLog | 11 | ||||
| -rw-r--r-- | Makefile.in | 2 | ||||
| -rw-r--r-- | aclocal.m4 | 5 | ||||
| -rwxr-xr-x | configure | 702 | ||||
| -rw-r--r-- | configure.in | 9 | ||||
| -rw-r--r-- | lib/Makefile.in | 44 | ||||
| -rw-r--r-- | lib/gnulib.mk | 42 | ||||
| -rw-r--r-- | lib/lstat.c | 91 | ||||
| -rw-r--r-- | lib/readlink.c | 74 | ||||
| -rw-r--r-- | lib/stat.c | 104 | ||||
| -rw-r--r-- | lib/stdlib.in.h | 30 | ||||
| -rw-r--r-- | lib/symlink.c | 57 | ||||
| -rw-r--r-- | m4/dos.m4 | 71 | ||||
| -rw-r--r-- | m4/gl-comp.m4 | 25 | ||||
| -rw-r--r-- | m4/lstat.m4 | 69 | ||||
| -rw-r--r-- | m4/readlink.m4 | 62 | ||||
| -rw-r--r-- | m4/stat.m4 | 67 | ||||
| -rw-r--r-- | m4/stdlib_h.m4 | 6 | ||||
| -rw-r--r-- | m4/symlink.m4 | 45 | ||||
| -rw-r--r-- | src/ChangeLog | 7 | ||||
| -rw-r--r-- | src/config.in | 40 | ||||
| -rw-r--r-- | src/fileio.c | 35 |
22 files changed, 1449 insertions, 149 deletions
| @@ -1,5 +1,16 @@ | |||
| 1 | 2011-02-22 Paul Eggert <eggert@cs.ucla.edu> | 1 | 2011-02-22 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 2 | ||
| 3 | Work around some portability problems with symlinks. | ||
| 4 | * Makefile.in (GNULIB_MODULES): Add lstat, readlink, symlink. | ||
| 5 | * configure.in (lstat, HAVE_LSTAT): Remove special hack. | ||
| 6 | * lib/lstat.c, lib/readlink.c, lib/stat.c, lib/symlink.c: | ||
| 7 | * m4/dos.m4, m4/lstat.m4, m4/readlink.m4, m4/stat.m4, m4/symlink.m4: | ||
| 8 | New files, automatically generated from gnulib. | ||
| 9 | * aclocal.m4, configure, lib/Makefile.in, lib/gnulib.mk: | ||
| 10 | * lib/stdlib.in.h, m4/gl-comp.m4, m4/stdlib_h.m4: Regenerate. | ||
| 11 | |||
| 12 | 2011-02-22 Paul Eggert <eggert@cs.ucla.edu> | ||
| 13 | |||
| 3 | Assume S_ISLNK etc. work, since gnulib supports this. | 14 | Assume S_ISLNK etc. work, since gnulib supports this. |
| 4 | * Makefile.in (GNULIB_MODULES): Add sys_stat. | 15 | * Makefile.in (GNULIB_MODULES): Add sys_stat. |
| 5 | * configure.in: Check for lstat and set HAVE_LSTAT=0 if not. | 16 | * configure.in: Check for lstat and set HAVE_LSTAT=0 if not. |
diff --git a/Makefile.in b/Makefile.in index 489409afe5b..7bd4318bfba 100644 --- a/Makefile.in +++ b/Makefile.in | |||
| @@ -332,7 +332,7 @@ DOS_gnulib_comp.m4 = gl-comp.m4 | |||
| 332 | # as per $(gnulib_srcdir)/DEPENDENCIES. | 332 | # as per $(gnulib_srcdir)/DEPENDENCIES. |
| 333 | GNULIB_MODULES = \ | 333 | GNULIB_MODULES = \ |
| 334 | crypto/md5 dtoastr filemode getloadavg getopt-gnu \ | 334 | crypto/md5 dtoastr filemode getloadavg getopt-gnu \ |
| 335 | ignore-value mktime strftime sys_stat | 335 | ignore-value lstat mktime readlink strftime symlink sys_stat |
| 336 | GNULIB_TOOL_FLAGS = \ | 336 | GNULIB_TOOL_FLAGS = \ |
| 337 | --import --no-changelog --no-vc-files --makefile-name=gnulib.mk | 337 | --import --no-changelog --no-vc-files --makefile-name=gnulib.mk |
| 338 | sync-from-gnulib: $(gnulib_srcdir) | 338 | sync-from-gnulib: $(gnulib_srcdir) |
diff --git a/aclocal.m4 b/aclocal.m4 index 880166dc34e..7bc72240c80 100644 --- a/aclocal.m4 +++ b/aclocal.m4 | |||
| @@ -986,6 +986,7 @@ AC_SUBST([am__untar]) | |||
| 986 | 986 | ||
| 987 | m4_include([m4/00gnulib.m4]) | 987 | m4_include([m4/00gnulib.m4]) |
| 988 | m4_include([m4/c-strtod.m4]) | 988 | m4_include([m4/c-strtod.m4]) |
| 989 | m4_include([m4/dos.m4]) | ||
| 989 | m4_include([m4/extensions.m4]) | 990 | m4_include([m4/extensions.m4]) |
| 990 | m4_include([m4/filemode.m4]) | 991 | m4_include([m4/filemode.m4]) |
| 991 | m4_include([m4/getloadavg.m4]) | 992 | m4_include([m4/getloadavg.m4]) |
| @@ -994,15 +995,19 @@ m4_include([m4/gl-comp.m4]) | |||
| 994 | m4_include([m4/gnulib-common.m4]) | 995 | m4_include([m4/gnulib-common.m4]) |
| 995 | m4_include([m4/include_next.m4]) | 996 | m4_include([m4/include_next.m4]) |
| 996 | m4_include([m4/longlong.m4]) | 997 | m4_include([m4/longlong.m4]) |
| 998 | m4_include([m4/lstat.m4]) | ||
| 997 | m4_include([m4/md5.m4]) | 999 | m4_include([m4/md5.m4]) |
| 998 | m4_include([m4/mktime.m4]) | 1000 | m4_include([m4/mktime.m4]) |
| 999 | m4_include([m4/multiarch.m4]) | 1001 | m4_include([m4/multiarch.m4]) |
| 1002 | m4_include([m4/readlink.m4]) | ||
| 1000 | m4_include([m4/st_dm_mode.m4]) | 1003 | m4_include([m4/st_dm_mode.m4]) |
| 1004 | m4_include([m4/stat.m4]) | ||
| 1001 | m4_include([m4/stdbool.m4]) | 1005 | m4_include([m4/stdbool.m4]) |
| 1002 | m4_include([m4/stddef_h.m4]) | 1006 | m4_include([m4/stddef_h.m4]) |
| 1003 | m4_include([m4/stdint.m4]) | 1007 | m4_include([m4/stdint.m4]) |
| 1004 | m4_include([m4/stdlib_h.m4]) | 1008 | m4_include([m4/stdlib_h.m4]) |
| 1005 | m4_include([m4/strftime.m4]) | 1009 | m4_include([m4/strftime.m4]) |
| 1010 | m4_include([m4/symlink.m4]) | ||
| 1006 | m4_include([m4/sys_stat_h.m4]) | 1011 | m4_include([m4/sys_stat_h.m4]) |
| 1007 | m4_include([m4/time_h.m4]) | 1012 | m4_include([m4/time_h.m4]) |
| 1008 | m4_include([m4/time_r.m4]) | 1013 | m4_include([m4/time_r.m4]) |
| @@ -679,38 +679,6 @@ NEXT_AS_FIRST_DIRECTIVE_TIME_H | |||
| 679 | NEXT_TIME_H | 679 | NEXT_TIME_H |
| 680 | NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H | 680 | NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H |
| 681 | NEXT_SYS_STAT_H | 681 | NEXT_SYS_STAT_H |
| 682 | REPLACE_UTIMENSAT | ||
| 683 | REPLACE_STAT | ||
| 684 | REPLACE_MKNOD | ||
| 685 | REPLACE_MKFIFO | ||
| 686 | REPLACE_MKDIR | ||
| 687 | REPLACE_LSTAT | ||
| 688 | REPLACE_FUTIMENS | ||
| 689 | REPLACE_FSTATAT | ||
| 690 | REPLACE_FSTAT | ||
| 691 | HAVE_UTIMENSAT | ||
| 692 | HAVE_MKNODAT | ||
| 693 | HAVE_MKNOD | ||
| 694 | HAVE_MKFIFOAT | ||
| 695 | HAVE_MKFIFO | ||
| 696 | HAVE_MKDIRAT | ||
| 697 | HAVE_LSTAT | ||
| 698 | HAVE_LCHMOD | ||
| 699 | HAVE_FUTIMENS | ||
| 700 | HAVE_FSTATAT | ||
| 701 | HAVE_FCHMODAT | ||
| 702 | GNULIB_UTIMENSAT | ||
| 703 | GNULIB_STAT | ||
| 704 | GNULIB_MKNODAT | ||
| 705 | GNULIB_MKNOD | ||
| 706 | GNULIB_MKFIFOAT | ||
| 707 | GNULIB_MKFIFO | ||
| 708 | GNULIB_MKDIRAT | ||
| 709 | GNULIB_LSTAT | ||
| 710 | GNULIB_LCHMOD | ||
| 711 | GNULIB_FUTIMENS | ||
| 712 | GNULIB_FSTATAT | ||
| 713 | GNULIB_FCHMODAT | ||
| 714 | NEXT_AS_FIRST_DIRECTIVE_STDLIB_H | 682 | NEXT_AS_FIRST_DIRECTIVE_STDLIB_H |
| 715 | NEXT_STDLIB_H | 683 | NEXT_STDLIB_H |
| 716 | STDINT_H | 684 | STDINT_H |
| @@ -758,6 +726,38 @@ GNULIB_TIMEGM | |||
| 758 | GNULIB_STRPTIME | 726 | GNULIB_STRPTIME |
| 759 | GNULIB_NANOSLEEP | 727 | GNULIB_NANOSLEEP |
| 760 | GNULIB_MKTIME | 728 | GNULIB_MKTIME |
| 729 | REPLACE_UTIMENSAT | ||
| 730 | REPLACE_STAT | ||
| 731 | REPLACE_MKNOD | ||
| 732 | REPLACE_MKFIFO | ||
| 733 | REPLACE_MKDIR | ||
| 734 | REPLACE_LSTAT | ||
| 735 | REPLACE_FUTIMENS | ||
| 736 | REPLACE_FSTATAT | ||
| 737 | REPLACE_FSTAT | ||
| 738 | HAVE_UTIMENSAT | ||
| 739 | HAVE_MKNODAT | ||
| 740 | HAVE_MKNOD | ||
| 741 | HAVE_MKFIFOAT | ||
| 742 | HAVE_MKFIFO | ||
| 743 | HAVE_MKDIRAT | ||
| 744 | HAVE_LSTAT | ||
| 745 | HAVE_LCHMOD | ||
| 746 | HAVE_FUTIMENS | ||
| 747 | HAVE_FSTATAT | ||
| 748 | HAVE_FCHMODAT | ||
| 749 | GNULIB_UTIMENSAT | ||
| 750 | GNULIB_STAT | ||
| 751 | GNULIB_MKNODAT | ||
| 752 | GNULIB_MKNOD | ||
| 753 | GNULIB_MKFIFOAT | ||
| 754 | GNULIB_MKFIFO | ||
| 755 | GNULIB_MKDIRAT | ||
| 756 | GNULIB_LSTAT | ||
| 757 | GNULIB_LCHMOD | ||
| 758 | GNULIB_FUTIMENS | ||
| 759 | GNULIB_FSTATAT | ||
| 760 | GNULIB_FCHMODAT | ||
| 761 | LTLIBINTL | 761 | LTLIBINTL |
| 762 | LIBINTL | 762 | LIBINTL |
| 763 | GETOPT_H | 763 | GETOPT_H |
| @@ -874,6 +874,7 @@ GNULIB_DUP2 | |||
| 874 | GNULIB_CLOSE | 874 | GNULIB_CLOSE |
| 875 | GNULIB_CHOWN | 875 | GNULIB_CHOWN |
| 876 | GETLOADAVG_LIBS | 876 | GETLOADAVG_LIBS |
| 877 | REPLACE_WCTOMB | ||
| 877 | REPLACE_UNSETENV | 878 | REPLACE_UNSETENV |
| 878 | REPLACE_STRTOD | 879 | REPLACE_STRTOD |
| 879 | REPLACE_SETENV | 880 | REPLACE_SETENV |
| @@ -881,6 +882,7 @@ REPLACE_REALPATH | |||
| 881 | REPLACE_REALLOC | 882 | REPLACE_REALLOC |
| 882 | REPLACE_PUTENV | 883 | REPLACE_PUTENV |
| 883 | REPLACE_MKSTEMP | 884 | REPLACE_MKSTEMP |
| 885 | REPLACE_MBTOWC | ||
| 884 | REPLACE_MALLOC | 886 | REPLACE_MALLOC |
| 885 | REPLACE_CANONICALIZE_FILE_NAME | 887 | REPLACE_CANONICALIZE_FILE_NAME |
| 886 | REPLACE_CALLOC | 888 | REPLACE_CALLOC |
| @@ -909,6 +911,7 @@ HAVE_DECL_GETLOADAVG | |||
| 909 | HAVE_CANONICALIZE_FILE_NAME | 911 | HAVE_CANONICALIZE_FILE_NAME |
| 910 | HAVE_ATOLL | 912 | HAVE_ATOLL |
| 911 | HAVE__EXIT | 913 | HAVE__EXIT |
| 914 | GNULIB_WCTOMB | ||
| 912 | GNULIB_UNSETENV | 915 | GNULIB_UNSETENV |
| 913 | GNULIB_UNLOCKPT | 916 | GNULIB_UNLOCKPT |
| 914 | GNULIB_SYSTEM_POSIX | 917 | GNULIB_SYSTEM_POSIX |
| @@ -927,6 +930,7 @@ GNULIB_MKSTEMP | |||
| 927 | GNULIB_MKOSTEMPS | 930 | GNULIB_MKOSTEMPS |
| 928 | GNULIB_MKOSTEMP | 931 | GNULIB_MKOSTEMP |
| 929 | GNULIB_MKDTEMP | 932 | GNULIB_MKDTEMP |
| 933 | GNULIB_MBTOWC | ||
| 930 | GNULIB_MALLOC_POSIX | 934 | GNULIB_MALLOC_POSIX |
| 931 | GNULIB_GRANTPT | 935 | GNULIB_GRANTPT |
| 932 | GNULIB_GETSUBOPT | 936 | GNULIB_GETSUBOPT |
| @@ -2956,14 +2960,16 @@ as_fn_append ac_header_list " unistd.h" | |||
| 2956 | as_fn_append ac_header_list " sys/param.h" | 2960 | as_fn_append ac_header_list " sys/param.h" |
| 2957 | gl_getopt_required=GNU | 2961 | gl_getopt_required=GNU |
| 2958 | as_fn_append ac_header_list " getopt.h" | 2962 | as_fn_append ac_header_list " getopt.h" |
| 2963 | as_fn_append ac_func_list " lstat" | ||
| 2959 | as_fn_append ac_func_list " alarm" | 2964 | as_fn_append ac_func_list " alarm" |
| 2965 | as_fn_append ac_func_list " readlink" | ||
| 2960 | as_fn_append ac_header_list " wchar.h" | 2966 | as_fn_append ac_header_list " wchar.h" |
| 2961 | as_fn_append ac_header_list " stdint.h" | 2967 | as_fn_append ac_header_list " stdint.h" |
| 2962 | as_fn_append ac_func_list " tzset" | 2968 | as_fn_append ac_func_list " tzset" |
| 2969 | as_fn_append ac_func_list " symlink" | ||
| 2963 | as_fn_append ac_header_list " sys/stat.h" | 2970 | as_fn_append ac_header_list " sys/stat.h" |
| 2964 | as_fn_append ac_header_list " sys/time.h" | 2971 | as_fn_append ac_header_list " sys/time.h" |
| 2965 | as_fn_append ac_func_list " localtime_r" | 2972 | as_fn_append ac_func_list " localtime_r" |
| 2966 | as_fn_append ac_func_list " lstat" | ||
| 2967 | # Check that the precious variables saved in the cache have kept the same | 2973 | # Check that the precious variables saved in the cache have kept the same |
| 2968 | # value. | 2974 | # value. |
| 2969 | ac_cache_corrupted=false | 2975 | ac_cache_corrupted=false |
| @@ -6133,13 +6139,17 @@ $as_echo "$ac_cv_safe_to_define___extensions__" >&6; } | |||
| 6133 | # Code from module ignore-value: | 6139 | # Code from module ignore-value: |
| 6134 | # Code from module include_next: | 6140 | # Code from module include_next: |
| 6135 | # Code from module intprops: | 6141 | # Code from module intprops: |
| 6142 | # Code from module lstat: | ||
| 6136 | # Code from module mktime: | 6143 | # Code from module mktime: |
| 6137 | # Code from module multiarch: | 6144 | # Code from module multiarch: |
| 6145 | # Code from module readlink: | ||
| 6146 | # Code from module stat: | ||
| 6138 | # Code from module stdbool: | 6147 | # Code from module stdbool: |
| 6139 | # Code from module stddef: | 6148 | # Code from module stddef: |
| 6140 | # Code from module stdint: | 6149 | # Code from module stdint: |
| 6141 | # Code from module stdlib: | 6150 | # Code from module stdlib: |
| 6142 | # Code from module strftime: | 6151 | # Code from module strftime: |
| 6152 | # Code from module symlink: | ||
| 6143 | # Code from module sys_stat: | 6153 | # Code from module sys_stat: |
| 6144 | # Code from module time: | 6154 | # Code from module time: |
| 6145 | # Code from module time_r: | 6155 | # Code from module time_r: |
| @@ -13780,6 +13790,7 @@ _ACEOF | |||
| 13780 | GNULIB_GETSUBOPT=0; | 13790 | GNULIB_GETSUBOPT=0; |
| 13781 | GNULIB_GRANTPT=0; | 13791 | GNULIB_GRANTPT=0; |
| 13782 | GNULIB_MALLOC_POSIX=0; | 13792 | GNULIB_MALLOC_POSIX=0; |
| 13793 | GNULIB_MBTOWC=0; | ||
| 13783 | GNULIB_MKDTEMP=0; | 13794 | GNULIB_MKDTEMP=0; |
| 13784 | GNULIB_MKOSTEMP=0; | 13795 | GNULIB_MKOSTEMP=0; |
| 13785 | GNULIB_MKOSTEMPS=0; | 13796 | GNULIB_MKOSTEMPS=0; |
| @@ -13798,6 +13809,7 @@ _ACEOF | |||
| 13798 | GNULIB_SYSTEM_POSIX=0; | 13809 | GNULIB_SYSTEM_POSIX=0; |
| 13799 | GNULIB_UNLOCKPT=0; | 13810 | GNULIB_UNLOCKPT=0; |
| 13800 | GNULIB_UNSETENV=0; | 13811 | GNULIB_UNSETENV=0; |
| 13812 | GNULIB_WCTOMB=0; | ||
| 13801 | HAVE__EXIT=1; | 13813 | HAVE__EXIT=1; |
| 13802 | HAVE_ATOLL=1; | 13814 | HAVE_ATOLL=1; |
| 13803 | HAVE_CANONICALIZE_FILE_NAME=1; | 13815 | HAVE_CANONICALIZE_FILE_NAME=1; |
| @@ -13826,6 +13838,7 @@ _ACEOF | |||
| 13826 | REPLACE_CALLOC=0; | 13838 | REPLACE_CALLOC=0; |
| 13827 | REPLACE_CANONICALIZE_FILE_NAME=0; | 13839 | REPLACE_CANONICALIZE_FILE_NAME=0; |
| 13828 | REPLACE_MALLOC=0; | 13840 | REPLACE_MALLOC=0; |
| 13841 | REPLACE_MBTOWC=0; | ||
| 13829 | REPLACE_MKSTEMP=0; | 13842 | REPLACE_MKSTEMP=0; |
| 13830 | REPLACE_PUTENV=0; | 13843 | REPLACE_PUTENV=0; |
| 13831 | REPLACE_REALLOC=0; | 13844 | REPLACE_REALLOC=0; |
| @@ -13833,6 +13846,7 @@ _ACEOF | |||
| 13833 | REPLACE_SETENV=0; | 13846 | REPLACE_SETENV=0; |
| 13834 | REPLACE_STRTOD=0; | 13847 | REPLACE_STRTOD=0; |
| 13835 | REPLACE_UNSETENV=0; | 13848 | REPLACE_UNSETENV=0; |
| 13849 | REPLACE_WCTOMB=0; | ||
| 13836 | 13850 | ||
| 13837 | 13851 | ||
| 13838 | GNULIB_CHOWN=0; | 13852 | GNULIB_CHOWN=0; |
| @@ -14492,19 +14506,38 @@ fi | |||
| 14492 | 14506 | ||
| 14493 | 14507 | ||
| 14494 | 14508 | ||
| 14495 | GNULIB_MKTIME=0; | 14509 | GNULIB_FCHMODAT=0; |
| 14496 | GNULIB_NANOSLEEP=0; | 14510 | GNULIB_FSTATAT=0; |
| 14497 | GNULIB_STRPTIME=0; | 14511 | GNULIB_FUTIMENS=0; |
| 14498 | GNULIB_TIMEGM=0; | 14512 | GNULIB_LCHMOD=0; |
| 14499 | GNULIB_TIME_R=0; | 14513 | GNULIB_LSTAT=0; |
| 14500 | HAVE_DECL_LOCALTIME_R=1; | 14514 | GNULIB_MKDIRAT=0; |
| 14501 | HAVE_NANOSLEEP=1; | 14515 | GNULIB_MKFIFO=0; |
| 14502 | HAVE_STRPTIME=1; | 14516 | GNULIB_MKFIFOAT=0; |
| 14503 | HAVE_TIMEGM=1; | 14517 | GNULIB_MKNOD=0; |
| 14504 | REPLACE_LOCALTIME_R=GNULIB_PORTCHECK; | 14518 | GNULIB_MKNODAT=0; |
| 14505 | REPLACE_MKTIME=GNULIB_PORTCHECK; | 14519 | GNULIB_STAT=0; |
| 14506 | REPLACE_NANOSLEEP=GNULIB_PORTCHECK; | 14520 | GNULIB_UTIMENSAT=0; |
| 14507 | REPLACE_TIMEGM=GNULIB_PORTCHECK; | 14521 | HAVE_FCHMODAT=1; |
| 14522 | HAVE_FSTATAT=1; | ||
| 14523 | HAVE_FUTIMENS=1; | ||
| 14524 | HAVE_LCHMOD=1; | ||
| 14525 | HAVE_LSTAT=1; | ||
| 14526 | HAVE_MKDIRAT=1; | ||
| 14527 | HAVE_MKFIFO=1; | ||
| 14528 | HAVE_MKFIFOAT=1; | ||
| 14529 | HAVE_MKNOD=1; | ||
| 14530 | HAVE_MKNODAT=1; | ||
| 14531 | HAVE_UTIMENSAT=1; | ||
| 14532 | REPLACE_FSTAT=0; | ||
| 14533 | REPLACE_FSTATAT=0; | ||
| 14534 | REPLACE_FUTIMENS=0; | ||
| 14535 | REPLACE_LSTAT=0; | ||
| 14536 | REPLACE_MKDIR=0; | ||
| 14537 | REPLACE_MKFIFO=0; | ||
| 14538 | REPLACE_MKNOD=0; | ||
| 14539 | REPLACE_STAT=0; | ||
| 14540 | REPLACE_UTIMENSAT=0; | ||
| 14508 | 14541 | ||
| 14509 | 14542 | ||
| 14510 | 14543 | ||
| @@ -14524,6 +14557,93 @@ done | |||
| 14524 | 14557 | ||
| 14525 | 14558 | ||
| 14526 | 14559 | ||
| 14560 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether lstat correctly handles trailing slash" >&5 | ||
| 14561 | $as_echo_n "checking whether lstat correctly handles trailing slash... " >&6; } | ||
| 14562 | if ${ac_cv_func_lstat_dereferences_slashed_symlink+:} false; then : | ||
| 14563 | $as_echo_n "(cached) " >&6 | ||
| 14564 | else | ||
| 14565 | rm -f conftest.sym conftest.file | ||
| 14566 | echo >conftest.file | ||
| 14567 | if test "$as_ln_s" = "ln -s" && ln -s conftest.file conftest.sym; then | ||
| 14568 | if test "$cross_compiling" = yes; then : | ||
| 14569 | # When cross-compiling, be pessimistic so we will end up using the | ||
| 14570 | # replacement version of lstat that checks for trailing slashes and | ||
| 14571 | # calls lstat a second time when necessary. | ||
| 14572 | ac_cv_func_lstat_dereferences_slashed_symlink=no | ||
| 14573 | |||
| 14574 | else | ||
| 14575 | cat confdefs.h - <<_ACEOF >conftest.$ac_ext | ||
| 14576 | /* end confdefs.h. */ | ||
| 14577 | $ac_includes_default | ||
| 14578 | int | ||
| 14579 | main () | ||
| 14580 | { | ||
| 14581 | struct stat sbuf; | ||
| 14582 | /* Linux will dereference the symlink and fail, as required by | ||
| 14583 | POSIX. That is better in the sense that it means we will not | ||
| 14584 | have to compile and use the lstat wrapper. */ | ||
| 14585 | return lstat ("conftest.sym/", &sbuf) == 0; | ||
| 14586 | |||
| 14587 | ; | ||
| 14588 | return 0; | ||
| 14589 | } | ||
| 14590 | _ACEOF | ||
| 14591 | if ac_fn_c_try_run "$LINENO"; then : | ||
| 14592 | ac_cv_func_lstat_dereferences_slashed_symlink=yes | ||
| 14593 | else | ||
| 14594 | ac_cv_func_lstat_dereferences_slashed_symlink=no | ||
| 14595 | fi | ||
| 14596 | rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ | ||
| 14597 | conftest.$ac_objext conftest.beam conftest.$ac_ext | ||
| 14598 | fi | ||
| 14599 | |||
| 14600 | else | ||
| 14601 | # If the 'ln -s' command failed, then we probably don't even | ||
| 14602 | # have an lstat function. | ||
| 14603 | ac_cv_func_lstat_dereferences_slashed_symlink=no | ||
| 14604 | fi | ||
| 14605 | rm -f conftest.sym conftest.file | ||
| 14606 | |||
| 14607 | fi | ||
| 14608 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_lstat_dereferences_slashed_symlink" >&5 | ||
| 14609 | $as_echo "$ac_cv_func_lstat_dereferences_slashed_symlink" >&6; } | ||
| 14610 | test $ac_cv_func_lstat_dereferences_slashed_symlink = yes && | ||
| 14611 | |||
| 14612 | cat >>confdefs.h <<_ACEOF | ||
| 14613 | #define LSTAT_FOLLOWS_SLASHED_SYMLINK 1 | ||
| 14614 | _ACEOF | ||
| 14615 | |||
| 14616 | if test "x$ac_cv_func_lstat_dereferences_slashed_symlink" = xno; then | ||
| 14617 | |||
| 14618 | |||
| 14619 | |||
| 14620 | |||
| 14621 | |||
| 14622 | |||
| 14623 | |||
| 14624 | |||
| 14625 | gl_LIBOBJS="$gl_LIBOBJS lstat.$ac_objext" | ||
| 14626 | |||
| 14627 | fi | ||
| 14628 | |||
| 14629 | |||
| 14630 | GNULIB_MKTIME=0; | ||
| 14631 | GNULIB_NANOSLEEP=0; | ||
| 14632 | GNULIB_STRPTIME=0; | ||
| 14633 | GNULIB_TIMEGM=0; | ||
| 14634 | GNULIB_TIME_R=0; | ||
| 14635 | HAVE_DECL_LOCALTIME_R=1; | ||
| 14636 | HAVE_NANOSLEEP=1; | ||
| 14637 | HAVE_STRPTIME=1; | ||
| 14638 | HAVE_TIMEGM=1; | ||
| 14639 | REPLACE_LOCALTIME_R=GNULIB_PORTCHECK; | ||
| 14640 | REPLACE_MKTIME=GNULIB_PORTCHECK; | ||
| 14641 | REPLACE_NANOSLEEP=GNULIB_PORTCHECK; | ||
| 14642 | REPLACE_TIMEGM=GNULIB_PORTCHECK; | ||
| 14643 | |||
| 14644 | |||
| 14645 | |||
| 14646 | |||
| 14527 | gl_cv_c_multiarch=no | 14647 | gl_cv_c_multiarch=no |
| 14528 | cat confdefs.h - <<_ACEOF >conftest.$ac_ext | 14648 | cat confdefs.h - <<_ACEOF >conftest.$ac_ext |
| 14529 | /* end confdefs.h. */ | 14649 | /* end confdefs.h. */ |
| @@ -14565,6 +14685,104 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext | |||
| 14565 | fi | 14685 | fi |
| 14566 | 14686 | ||
| 14567 | 14687 | ||
| 14688 | |||
| 14689 | |||
| 14690 | |||
| 14691 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether system is Windows or MSDOS" >&5 | ||
| 14692 | $as_echo_n "checking whether system is Windows or MSDOS... " >&6; } | ||
| 14693 | if ${ac_cv_win_or_dos+:} false; then : | ||
| 14694 | $as_echo_n "(cached) " >&6 | ||
| 14695 | else | ||
| 14696 | |||
| 14697 | cat confdefs.h - <<_ACEOF >conftest.$ac_ext | ||
| 14698 | /* end confdefs.h. */ | ||
| 14699 | |||
| 14700 | int | ||
| 14701 | main () | ||
| 14702 | { | ||
| 14703 | |||
| 14704 | #if !defined _WIN32 && !defined __WIN32__ && !defined __MSDOS__ && !defined __CYGWIN__ | ||
| 14705 | neither MSDOS nor Windows | ||
| 14706 | #endif | ||
| 14707 | ; | ||
| 14708 | return 0; | ||
| 14709 | } | ||
| 14710 | _ACEOF | ||
| 14711 | if ac_fn_c_try_compile "$LINENO"; then : | ||
| 14712 | ac_cv_win_or_dos=yes | ||
| 14713 | else | ||
| 14714 | ac_cv_win_or_dos=no | ||
| 14715 | fi | ||
| 14716 | rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext | ||
| 14717 | |||
| 14718 | fi | ||
| 14719 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_win_or_dos" >&5 | ||
| 14720 | $as_echo "$ac_cv_win_or_dos" >&6; } | ||
| 14721 | |||
| 14722 | if test x"$ac_cv_win_or_dos" = xyes; then | ||
| 14723 | ac_fs_accepts_drive_letter_prefix=1 | ||
| 14724 | ac_fs_backslash_is_file_name_separator=1 | ||
| 14725 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether drive letter can start relative path" >&5 | ||
| 14726 | $as_echo_n "checking whether drive letter can start relative path... " >&6; } | ||
| 14727 | if ${ac_cv_drive_letter_can_be_relative+:} false; then : | ||
| 14728 | $as_echo_n "(cached) " >&6 | ||
| 14729 | else | ||
| 14730 | |||
| 14731 | cat confdefs.h - <<_ACEOF >conftest.$ac_ext | ||
| 14732 | /* end confdefs.h. */ | ||
| 14733 | |||
| 14734 | int | ||
| 14735 | main () | ||
| 14736 | { | ||
| 14737 | |||
| 14738 | #if defined __CYGWIN__ | ||
| 14739 | drive letters are always absolute | ||
| 14740 | #endif | ||
| 14741 | ; | ||
| 14742 | return 0; | ||
| 14743 | } | ||
| 14744 | _ACEOF | ||
| 14745 | if ac_fn_c_try_compile "$LINENO"; then : | ||
| 14746 | ac_cv_drive_letter_can_be_relative=yes | ||
| 14747 | else | ||
| 14748 | ac_cv_drive_letter_can_be_relative=no | ||
| 14749 | fi | ||
| 14750 | rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext | ||
| 14751 | |||
| 14752 | fi | ||
| 14753 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_drive_letter_can_be_relative" >&5 | ||
| 14754 | $as_echo "$ac_cv_drive_letter_can_be_relative" >&6; } | ||
| 14755 | if test x"$ac_cv_drive_letter_can_be_relative" = xyes; then | ||
| 14756 | ac_fs_drive_letter_can_be_relative=1 | ||
| 14757 | else | ||
| 14758 | ac_fs_drive_letter_can_be_relative=0 | ||
| 14759 | fi | ||
| 14760 | else | ||
| 14761 | ac_fs_accepts_drive_letter_prefix=0 | ||
| 14762 | ac_fs_backslash_is_file_name_separator=0 | ||
| 14763 | ac_fs_drive_letter_can_be_relative=0 | ||
| 14764 | fi | ||
| 14765 | |||
| 14766 | |||
| 14767 | cat >>confdefs.h <<_ACEOF | ||
| 14768 | #define FILE_SYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX $ac_fs_accepts_drive_letter_prefix | ||
| 14769 | _ACEOF | ||
| 14770 | |||
| 14771 | |||
| 14772 | |||
| 14773 | |||
| 14774 | |||
| 14775 | cat >>confdefs.h <<_ACEOF | ||
| 14776 | #define FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR $ac_fs_backslash_is_file_name_separator | ||
| 14777 | _ACEOF | ||
| 14778 | |||
| 14779 | |||
| 14780 | |||
| 14781 | cat >>confdefs.h <<_ACEOF | ||
| 14782 | #define FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE $ac_fs_drive_letter_can_be_relative | ||
| 14783 | _ACEOF | ||
| 14784 | |||
| 14785 | |||
| 14568 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5 | 14786 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5 |
| 14569 | $as_echo_n "checking for stdbool.h that conforms to C99... " >&6; } | 14787 | $as_echo_n "checking for stdbool.h that conforms to C99... " >&6; } |
| 14570 | if ${ac_cv_header_stdbool_h+:} false; then : | 14788 | if ${ac_cv_header_stdbool_h+:} false; then : |
| @@ -14824,38 +15042,6 @@ fi | |||
| 14824 | 15042 | ||
| 14825 | 15043 | ||
| 14826 | 15044 | ||
| 14827 | GNULIB_FCHMODAT=0; | ||
| 14828 | GNULIB_FSTATAT=0; | ||
| 14829 | GNULIB_FUTIMENS=0; | ||
| 14830 | GNULIB_LCHMOD=0; | ||
| 14831 | GNULIB_LSTAT=0; | ||
| 14832 | GNULIB_MKDIRAT=0; | ||
| 14833 | GNULIB_MKFIFO=0; | ||
| 14834 | GNULIB_MKFIFOAT=0; | ||
| 14835 | GNULIB_MKNOD=0; | ||
| 14836 | GNULIB_MKNODAT=0; | ||
| 14837 | GNULIB_STAT=0; | ||
| 14838 | GNULIB_UTIMENSAT=0; | ||
| 14839 | HAVE_FCHMODAT=1; | ||
| 14840 | HAVE_FSTATAT=1; | ||
| 14841 | HAVE_FUTIMENS=1; | ||
| 14842 | HAVE_LCHMOD=1; | ||
| 14843 | HAVE_LSTAT=1; | ||
| 14844 | HAVE_MKDIRAT=1; | ||
| 14845 | HAVE_MKFIFO=1; | ||
| 14846 | HAVE_MKFIFOAT=1; | ||
| 14847 | HAVE_MKNOD=1; | ||
| 14848 | HAVE_MKNODAT=1; | ||
| 14849 | HAVE_UTIMENSAT=1; | ||
| 14850 | REPLACE_FSTAT=0; | ||
| 14851 | REPLACE_FSTATAT=0; | ||
| 14852 | REPLACE_FUTIMENS=0; | ||
| 14853 | REPLACE_LSTAT=0; | ||
| 14854 | REPLACE_MKDIR=0; | ||
| 14855 | REPLACE_MKFIFO=0; | ||
| 14856 | REPLACE_MKNOD=0; | ||
| 14857 | REPLACE_STAT=0; | ||
| 14858 | REPLACE_UTIMENSAT=0; | ||
| 14859 | 15045 | ||
| 14860 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stat file-mode macros are broken" >&5 | 15046 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stat file-mode macros are broken" >&5 |
| 14861 | $as_echo_n "checking whether stat file-mode macros are broken... " >&6; } | 15047 | $as_echo_n "checking whether stat file-mode macros are broken... " >&6; } |
| @@ -15768,6 +15954,28 @@ fi | |||
| 15768 | 15954 | ||
| 15769 | # Code from module include_next: | 15955 | # Code from module include_next: |
| 15770 | # Code from module intprops: | 15956 | # Code from module intprops: |
| 15957 | # Code from module lstat: | ||
| 15958 | |||
| 15959 | |||
| 15960 | |||
| 15961 | if test $ac_cv_func_lstat = yes; then | ||
| 15962 | |||
| 15963 | if test $ac_cv_func_lstat_dereferences_slashed_symlink = no; then | ||
| 15964 | REPLACE_LSTAT=1 | ||
| 15965 | fi | ||
| 15966 | # Prerequisites of lib/lstat.c. | ||
| 15967 | |||
| 15968 | else | ||
| 15969 | HAVE_LSTAT=0 | ||
| 15970 | fi | ||
| 15971 | |||
| 15972 | |||
| 15973 | |||
| 15974 | |||
| 15975 | GNULIB_LSTAT=1 | ||
| 15976 | |||
| 15977 | |||
| 15978 | |||
| 15771 | # Code from module mktime: | 15979 | # Code from module mktime: |
| 15772 | 15980 | ||
| 15773 | 15981 | ||
| @@ -16025,6 +16233,247 @@ fi | |||
| 16025 | 16233 | ||
| 16026 | # Code from module multiarch: | 16234 | # Code from module multiarch: |
| 16027 | 16235 | ||
| 16236 | # Code from module readlink: | ||
| 16237 | |||
| 16238 | |||
| 16239 | |||
| 16240 | if test $ac_cv_func_readlink = no; then | ||
| 16241 | HAVE_READLINK=0 | ||
| 16242 | |||
| 16243 | |||
| 16244 | |||
| 16245 | |||
| 16246 | |||
| 16247 | |||
| 16248 | |||
| 16249 | |||
| 16250 | gl_LIBOBJS="$gl_LIBOBJS readlink.$ac_objext" | ||
| 16251 | |||
| 16252 | |||
| 16253 | : | ||
| 16254 | |||
| 16255 | else | ||
| 16256 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether readlink signature is correct" >&5 | ||
| 16257 | $as_echo_n "checking whether readlink signature is correct... " >&6; } | ||
| 16258 | if ${gl_cv_decl_readlink_works+:} false; then : | ||
| 16259 | $as_echo_n "(cached) " >&6 | ||
| 16260 | else | ||
| 16261 | cat confdefs.h - <<_ACEOF >conftest.$ac_ext | ||
| 16262 | /* end confdefs.h. */ | ||
| 16263 | #include <unistd.h> | ||
| 16264 | /* Cause compilation failure if original declaration has wrong type. */ | ||
| 16265 | ssize_t readlink (const char *, char *, size_t); | ||
| 16266 | int | ||
| 16267 | main () | ||
| 16268 | { | ||
| 16269 | |||
| 16270 | ; | ||
| 16271 | return 0; | ||
| 16272 | } | ||
| 16273 | _ACEOF | ||
| 16274 | if ac_fn_c_try_compile "$LINENO"; then : | ||
| 16275 | gl_cv_decl_readlink_works=yes | ||
| 16276 | else | ||
| 16277 | gl_cv_decl_readlink_works=no | ||
| 16278 | fi | ||
| 16279 | rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext | ||
| 16280 | fi | ||
| 16281 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_decl_readlink_works" >&5 | ||
| 16282 | $as_echo "$gl_cv_decl_readlink_works" >&6; } | ||
| 16283 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether readlink handles trailing slash correctly" >&5 | ||
| 16284 | $as_echo_n "checking whether readlink handles trailing slash correctly... " >&6; } | ||
| 16285 | if ${gl_cv_func_readlink_works+:} false; then : | ||
| 16286 | $as_echo_n "(cached) " >&6 | ||
| 16287 | else | ||
| 16288 | # We have readlink, so assume ln -s works. | ||
| 16289 | ln -s conftest.no-such conftest.link | ||
| 16290 | ln -s conftest.link conftest.lnk2 | ||
| 16291 | if test "$cross_compiling" = yes; then : | ||
| 16292 | gl_cv_func_readlink_works="guessing no" | ||
| 16293 | else | ||
| 16294 | cat confdefs.h - <<_ACEOF >conftest.$ac_ext | ||
| 16295 | /* end confdefs.h. */ | ||
| 16296 | #include <unistd.h> | ||
| 16297 | |||
| 16298 | int | ||
| 16299 | main () | ||
| 16300 | { | ||
| 16301 | char buf[20]; | ||
| 16302 | return readlink ("conftest.lnk2/", buf, sizeof buf) != -1; | ||
| 16303 | ; | ||
| 16304 | return 0; | ||
| 16305 | } | ||
| 16306 | _ACEOF | ||
| 16307 | if ac_fn_c_try_run "$LINENO"; then : | ||
| 16308 | gl_cv_func_readlink_works=yes | ||
| 16309 | else | ||
| 16310 | gl_cv_func_readlink_works=no | ||
| 16311 | fi | ||
| 16312 | rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ | ||
| 16313 | conftest.$ac_objext conftest.beam conftest.$ac_ext | ||
| 16314 | fi | ||
| 16315 | |||
| 16316 | rm -f conftest.link conftest.lnk2 | ||
| 16317 | fi | ||
| 16318 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_readlink_works" >&5 | ||
| 16319 | $as_echo "$gl_cv_func_readlink_works" >&6; } | ||
| 16320 | if test "$gl_cv_func_readlink_works" != yes; then | ||
| 16321 | |||
| 16322 | $as_echo "#define READLINK_TRAILING_SLASH_BUG 1" >>confdefs.h | ||
| 16323 | |||
| 16324 | REPLACE_READLINK=1 | ||
| 16325 | |||
| 16326 | |||
| 16327 | |||
| 16328 | |||
| 16329 | |||
| 16330 | |||
| 16331 | |||
| 16332 | |||
| 16333 | gl_LIBOBJS="$gl_LIBOBJS readlink.$ac_objext" | ||
| 16334 | |||
| 16335 | elif test "$gl_cv_decl_readlink_works" != yes; then | ||
| 16336 | REPLACE_READLINK=1 | ||
| 16337 | |||
| 16338 | |||
| 16339 | |||
| 16340 | |||
| 16341 | |||
| 16342 | |||
| 16343 | |||
| 16344 | |||
| 16345 | gl_LIBOBJS="$gl_LIBOBJS readlink.$ac_objext" | ||
| 16346 | |||
| 16347 | fi | ||
| 16348 | fi | ||
| 16349 | |||
| 16350 | |||
| 16351 | |||
| 16352 | |||
| 16353 | GNULIB_READLINK=1 | ||
| 16354 | |||
| 16355 | |||
| 16356 | |||
| 16357 | # Code from module stat: | ||
| 16358 | |||
| 16359 | |||
| 16360 | |||
| 16361 | |||
| 16362 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stat handles trailing slashes on directories" >&5 | ||
| 16363 | $as_echo_n "checking whether stat handles trailing slashes on directories... " >&6; } | ||
| 16364 | if ${gl_cv_func_stat_dir_slash+:} false; then : | ||
| 16365 | $as_echo_n "(cached) " >&6 | ||
| 16366 | else | ||
| 16367 | if test "$cross_compiling" = yes; then : | ||
| 16368 | case $host_os in | ||
| 16369 | mingw*) gl_cv_func_stat_dir_slash="guessing no";; | ||
| 16370 | *) gl_cv_func_stat_dir_slash="guessing yes";; | ||
| 16371 | esac | ||
| 16372 | else | ||
| 16373 | cat confdefs.h - <<_ACEOF >conftest.$ac_ext | ||
| 16374 | /* end confdefs.h. */ | ||
| 16375 | #include <sys/stat.h> | ||
| 16376 | |||
| 16377 | int | ||
| 16378 | main () | ||
| 16379 | { | ||
| 16380 | struct stat st; return stat (".", &st) != stat ("./", &st); | ||
| 16381 | ; | ||
| 16382 | return 0; | ||
| 16383 | } | ||
| 16384 | _ACEOF | ||
| 16385 | if ac_fn_c_try_run "$LINENO"; then : | ||
| 16386 | gl_cv_func_stat_dir_slash=yes | ||
| 16387 | else | ||
| 16388 | gl_cv_func_stat_dir_slash=no | ||
| 16389 | fi | ||
| 16390 | rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ | ||
| 16391 | conftest.$ac_objext conftest.beam conftest.$ac_ext | ||
| 16392 | fi | ||
| 16393 | |||
| 16394 | fi | ||
| 16395 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_stat_dir_slash" >&5 | ||
| 16396 | $as_echo "$gl_cv_func_stat_dir_slash" >&6; } | ||
| 16397 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stat handles trailing slashes on files" >&5 | ||
| 16398 | $as_echo_n "checking whether stat handles trailing slashes on files... " >&6; } | ||
| 16399 | if ${gl_cv_func_stat_file_slash+:} false; then : | ||
| 16400 | $as_echo_n "(cached) " >&6 | ||
| 16401 | else | ||
| 16402 | touch conftest.tmp | ||
| 16403 | # Assume that if we have lstat, we can also check symlinks. | ||
| 16404 | if test $ac_cv_func_lstat = yes; then | ||
| 16405 | ln -s conftest.tmp conftest.lnk | ||
| 16406 | fi | ||
| 16407 | if test "$cross_compiling" = yes; then : | ||
| 16408 | gl_cv_func_stat_file_slash="guessing no" | ||
| 16409 | else | ||
| 16410 | cat confdefs.h - <<_ACEOF >conftest.$ac_ext | ||
| 16411 | /* end confdefs.h. */ | ||
| 16412 | #include <sys/stat.h> | ||
| 16413 | |||
| 16414 | int | ||
| 16415 | main () | ||
| 16416 | { | ||
| 16417 | int result = 0; | ||
| 16418 | struct stat st; | ||
| 16419 | if (!stat ("conftest.tmp/", &st)) | ||
| 16420 | result |= 1; | ||
| 16421 | #if HAVE_LSTAT | ||
| 16422 | if (!stat ("conftest.lnk/", &st)) | ||
| 16423 | result |= 2; | ||
| 16424 | #endif | ||
| 16425 | return result; | ||
| 16426 | |||
| 16427 | ; | ||
| 16428 | return 0; | ||
| 16429 | } | ||
| 16430 | _ACEOF | ||
| 16431 | if ac_fn_c_try_run "$LINENO"; then : | ||
| 16432 | gl_cv_func_stat_file_slash=yes | ||
| 16433 | else | ||
| 16434 | gl_cv_func_stat_file_slash=no | ||
| 16435 | fi | ||
| 16436 | rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ | ||
| 16437 | conftest.$ac_objext conftest.beam conftest.$ac_ext | ||
| 16438 | fi | ||
| 16439 | |||
| 16440 | rm -f conftest.tmp conftest.lnk | ||
| 16441 | fi | ||
| 16442 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_stat_file_slash" >&5 | ||
| 16443 | $as_echo "$gl_cv_func_stat_file_slash" >&6; } | ||
| 16444 | case $gl_cv_func_stat_dir_slash in | ||
| 16445 | *no) REPLACE_STAT=1 | ||
| 16446 | |||
| 16447 | $as_echo "#define REPLACE_FUNC_STAT_DIR 1" >>confdefs.h | ||
| 16448 | ;; | ||
| 16449 | esac | ||
| 16450 | case $gl_cv_func_stat_file_slash in | ||
| 16451 | *no) REPLACE_STAT=1 | ||
| 16452 | |||
| 16453 | $as_echo "#define REPLACE_FUNC_STAT_FILE 1" >>confdefs.h | ||
| 16454 | ;; | ||
| 16455 | esac | ||
| 16456 | if test $REPLACE_STAT = 1; then | ||
| 16457 | |||
| 16458 | |||
| 16459 | |||
| 16460 | |||
| 16461 | |||
| 16462 | |||
| 16463 | |||
| 16464 | |||
| 16465 | gl_LIBOBJS="$gl_LIBOBJS stat.$ac_objext" | ||
| 16466 | |||
| 16467 | |||
| 16468 | fi | ||
| 16469 | |||
| 16470 | |||
| 16471 | |||
| 16472 | |||
| 16473 | GNULIB_STAT=1 | ||
| 16474 | |||
| 16475 | |||
| 16476 | |||
| 16028 | # Code from module stdbool: | 16477 | # Code from module stdbool: |
| 16029 | 16478 | ||
| 16030 | 16479 | ||
| @@ -16929,6 +17378,86 @@ $as_echo "#define my_strftime nstrftime" >>confdefs.h | |||
| 16929 | 17378 | ||
| 16930 | 17379 | ||
| 16931 | 17380 | ||
| 17381 | # Code from module symlink: | ||
| 17382 | |||
| 17383 | |||
| 17384 | |||
| 17385 | if test $ac_cv_func_symlink = no; then | ||
| 17386 | HAVE_SYMLINK=0 | ||
| 17387 | |||
| 17388 | |||
| 17389 | |||
| 17390 | |||
| 17391 | |||
| 17392 | |||
| 17393 | |||
| 17394 | |||
| 17395 | gl_LIBOBJS="$gl_LIBOBJS symlink.$ac_objext" | ||
| 17396 | |||
| 17397 | else | ||
| 17398 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether symlink handles trailing slash correctly" >&5 | ||
| 17399 | $as_echo_n "checking whether symlink handles trailing slash correctly... " >&6; } | ||
| 17400 | if ${gl_cv_func_symlink_works+:} false; then : | ||
| 17401 | $as_echo_n "(cached) " >&6 | ||
| 17402 | else | ||
| 17403 | if test "$cross_compiling" = yes; then : | ||
| 17404 | gl_cv_func_symlink_works="guessing no" | ||
| 17405 | else | ||
| 17406 | cat confdefs.h - <<_ACEOF >conftest.$ac_ext | ||
| 17407 | /* end confdefs.h. */ | ||
| 17408 | #include <unistd.h> | ||
| 17409 | |||
| 17410 | int | ||
| 17411 | main () | ||
| 17412 | { | ||
| 17413 | int result = 0; | ||
| 17414 | if (!symlink ("a", "conftest.link/")) | ||
| 17415 | result |= 1; | ||
| 17416 | if (symlink ("conftest.f", "conftest.lnk2")) | ||
| 17417 | result |= 2; | ||
| 17418 | else if (!symlink ("a", "conftest.lnk2/")) | ||
| 17419 | result |= 4; | ||
| 17420 | return result; | ||
| 17421 | |||
| 17422 | ; | ||
| 17423 | return 0; | ||
| 17424 | } | ||
| 17425 | _ACEOF | ||
| 17426 | if ac_fn_c_try_run "$LINENO"; then : | ||
| 17427 | gl_cv_func_symlink_works=yes | ||
| 17428 | else | ||
| 17429 | gl_cv_func_symlink_works=no | ||
| 17430 | fi | ||
| 17431 | rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ | ||
| 17432 | conftest.$ac_objext conftest.beam conftest.$ac_ext | ||
| 17433 | fi | ||
| 17434 | |||
| 17435 | rm -f conftest.f conftest.link conftest.lnk2 | ||
| 17436 | fi | ||
| 17437 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_symlink_works" >&5 | ||
| 17438 | $as_echo "$gl_cv_func_symlink_works" >&6; } | ||
| 17439 | if test "$gl_cv_func_symlink_works" != yes; then | ||
| 17440 | REPLACE_SYMLINK=1 | ||
| 17441 | |||
| 17442 | |||
| 17443 | |||
| 17444 | |||
| 17445 | |||
| 17446 | |||
| 17447 | |||
| 17448 | |||
| 17449 | gl_LIBOBJS="$gl_LIBOBJS symlink.$ac_objext" | ||
| 17450 | |||
| 17451 | fi | ||
| 17452 | fi | ||
| 17453 | |||
| 17454 | |||
| 17455 | |||
| 17456 | |||
| 17457 | GNULIB_SYMLINK=1 | ||
| 17458 | |||
| 17459 | |||
| 17460 | |||
| 16932 | # Code from module sys_stat: | 17461 | # Code from module sys_stat: |
| 16933 | 17462 | ||
| 16934 | 17463 | ||
| @@ -17212,23 +17741,6 @@ $as_echo "$gl_cv_next_unistd_h" >&6; } | |||
| 17212 | 17741 | ||
| 17213 | 17742 | ||
| 17214 | 17743 | ||
| 17215 | # Emacs does not care about lstat's behavior on files whose names end in | ||
| 17216 | # trailing slashes, so it does not use the gnulib lstat module. | ||
| 17217 | # However, Emacs does want the "#define lstat stat" in sys/stat.h | ||
| 17218 | # when lstat does not exist, so it pretends to use the lstat module | ||
| 17219 | # even though it implements only the lstat-checking part of that module. | ||
| 17220 | |||
| 17221 | |||
| 17222 | |||
| 17223 | test $ac_cv_func_lstat = yes || HAVE_LSTAT=0 | ||
| 17224 | |||
| 17225 | |||
| 17226 | |||
| 17227 | GNULIB_LSTAT=1 | ||
| 17228 | |||
| 17229 | |||
| 17230 | |||
| 17231 | |||
| 17232 | # UNIX98 PTYs. | 17744 | # UNIX98 PTYs. |
| 17233 | for ac_func in grantpt | 17745 | for ac_func in grantpt |
| 17234 | do : | 17746 | do : |
diff --git a/configure.in b/configure.in index fa5ae960c59..376c82c4ca4 100644 --- a/configure.in +++ b/configure.in | |||
| @@ -2661,15 +2661,6 @@ gl_ASSERT_NO_GNULIB_POSIXCHECK | |||
| 2661 | gl_ASSERT_NO_GNULIB_TESTS | 2661 | gl_ASSERT_NO_GNULIB_TESTS |
| 2662 | gl_INIT | 2662 | gl_INIT |
| 2663 | 2663 | ||
| 2664 | # Emacs does not care about lstat's behavior on files whose names end in | ||
| 2665 | # trailing slashes, so it does not use the gnulib lstat module. | ||
| 2666 | # However, Emacs does want the "#define lstat stat" in sys/stat.h | ||
| 2667 | # when lstat does not exist, so it pretends to use the lstat module | ||
| 2668 | # even though it implements only the lstat-checking part of that module. | ||
| 2669 | AC_CHECK_FUNCS_ONCE([lstat]) | ||
| 2670 | test $ac_cv_func_lstat = yes || HAVE_LSTAT=0 | ||
| 2671 | gl_SYS_STAT_MODULE_INDICATOR([lstat]) | ||
| 2672 | |||
| 2673 | # UNIX98 PTYs. | 2664 | # UNIX98 PTYs. |
| 2674 | AC_CHECK_FUNCS(grantpt) | 2665 | AC_CHECK_FUNCS(grantpt) |
| 2675 | 2666 | ||
diff --git a/lib/Makefile.in b/lib/Makefile.in index 48e7b1d6507..e9b9f2eb86e 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in | |||
| @@ -24,7 +24,7 @@ | |||
| 24 | # the same distribution terms as the rest of that program. | 24 | # the same distribution terms as the rest of that program. |
| 25 | # | 25 | # |
| 26 | # Generated by gnulib-tool. | 26 | # Generated by gnulib-tool. |
| 27 | # Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --makefile-name=gnulib.mk --no-libtool --macro-prefix=gl --no-vc-files crypto/md5 dtoastr filemode getloadavg getopt-gnu ignore-value mktime strftime sys_stat | 27 | # Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --makefile-name=gnulib.mk --no-libtool --macro-prefix=gl --no-vc-files crypto/md5 dtoastr filemode getloadavg getopt-gnu ignore-value lstat mktime readlink strftime symlink sys_stat |
| 28 | 28 | ||
| 29 | VPATH = @srcdir@ | 29 | VPATH = @srcdir@ |
| 30 | pkgdatadir = $(datadir)/@PACKAGE@ | 30 | pkgdatadir = $(datadir)/@PACKAGE@ |
| @@ -50,16 +50,18 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ | |||
| 50 | subdir = lib | 50 | subdir = lib |
| 51 | ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 | 51 | ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 |
| 52 | am__aclocal_m4_deps = $(top_srcdir)/m4/00gnulib.m4 \ | 52 | am__aclocal_m4_deps = $(top_srcdir)/m4/00gnulib.m4 \ |
| 53 | $(top_srcdir)/m4/c-strtod.m4 $(top_srcdir)/m4/extensions.m4 \ | 53 | $(top_srcdir)/m4/c-strtod.m4 $(top_srcdir)/m4/dos.m4 \ |
| 54 | $(top_srcdir)/m4/filemode.m4 $(top_srcdir)/m4/getloadavg.m4 \ | 54 | $(top_srcdir)/m4/extensions.m4 $(top_srcdir)/m4/filemode.m4 \ |
| 55 | $(top_srcdir)/m4/getopt.m4 $(top_srcdir)/m4/gl-comp.m4 \ | 55 | $(top_srcdir)/m4/getloadavg.m4 $(top_srcdir)/m4/getopt.m4 \ |
| 56 | $(top_srcdir)/m4/gnulib-common.m4 \ | 56 | $(top_srcdir)/m4/gl-comp.m4 $(top_srcdir)/m4/gnulib-common.m4 \ |
| 57 | $(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/longlong.m4 \ | 57 | $(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/longlong.m4 \ |
| 58 | $(top_srcdir)/m4/md5.m4 $(top_srcdir)/m4/mktime.m4 \ | 58 | $(top_srcdir)/m4/lstat.m4 $(top_srcdir)/m4/md5.m4 \ |
| 59 | $(top_srcdir)/m4/multiarch.m4 $(top_srcdir)/m4/st_dm_mode.m4 \ | 59 | $(top_srcdir)/m4/mktime.m4 $(top_srcdir)/m4/multiarch.m4 \ |
| 60 | $(top_srcdir)/m4/stdbool.m4 $(top_srcdir)/m4/stddef_h.m4 \ | 60 | $(top_srcdir)/m4/readlink.m4 $(top_srcdir)/m4/st_dm_mode.m4 \ |
| 61 | $(top_srcdir)/m4/stdint.m4 $(top_srcdir)/m4/stdlib_h.m4 \ | 61 | $(top_srcdir)/m4/stat.m4 $(top_srcdir)/m4/stdbool.m4 \ |
| 62 | $(top_srcdir)/m4/strftime.m4 $(top_srcdir)/m4/sys_stat_h.m4 \ | 62 | $(top_srcdir)/m4/stddef_h.m4 $(top_srcdir)/m4/stdint.m4 \ |
| 63 | $(top_srcdir)/m4/stdlib_h.m4 $(top_srcdir)/m4/strftime.m4 \ | ||
| 64 | $(top_srcdir)/m4/symlink.m4 $(top_srcdir)/m4/sys_stat_h.m4 \ | ||
| 63 | $(top_srcdir)/m4/time_h.m4 $(top_srcdir)/m4/time_r.m4 \ | 65 | $(top_srcdir)/m4/time_h.m4 $(top_srcdir)/m4/time_r.m4 \ |
| 64 | $(top_srcdir)/m4/tm_gmtoff.m4 $(top_srcdir)/m4/unistd_h.m4 \ | 66 | $(top_srcdir)/m4/tm_gmtoff.m4 $(top_srcdir)/m4/unistd_h.m4 \ |
| 65 | $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/configure.in | 67 | $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/configure.in |
| @@ -179,6 +181,7 @@ GNULIB_LINKAT = @GNULIB_LINKAT@ | |||
| 179 | GNULIB_LSEEK = @GNULIB_LSEEK@ | 181 | GNULIB_LSEEK = @GNULIB_LSEEK@ |
| 180 | GNULIB_LSTAT = @GNULIB_LSTAT@ | 182 | GNULIB_LSTAT = @GNULIB_LSTAT@ |
| 181 | GNULIB_MALLOC_POSIX = @GNULIB_MALLOC_POSIX@ | 183 | GNULIB_MALLOC_POSIX = @GNULIB_MALLOC_POSIX@ |
| 184 | GNULIB_MBTOWC = @GNULIB_MBTOWC@ | ||
| 182 | GNULIB_MKDIRAT = @GNULIB_MKDIRAT@ | 185 | GNULIB_MKDIRAT = @GNULIB_MKDIRAT@ |
| 183 | GNULIB_MKDTEMP = @GNULIB_MKDTEMP@ | 186 | GNULIB_MKDTEMP = @GNULIB_MKDTEMP@ |
| 184 | GNULIB_MKFIFO = @GNULIB_MKFIFO@ | 187 | GNULIB_MKFIFO = @GNULIB_MKFIFO@ |
| @@ -225,6 +228,7 @@ GNULIB_UNLOCKPT = @GNULIB_UNLOCKPT@ | |||
| 225 | GNULIB_UNSETENV = @GNULIB_UNSETENV@ | 228 | GNULIB_UNSETENV = @GNULIB_UNSETENV@ |
| 226 | GNULIB_USLEEP = @GNULIB_USLEEP@ | 229 | GNULIB_USLEEP = @GNULIB_USLEEP@ |
| 227 | GNULIB_UTIMENSAT = @GNULIB_UTIMENSAT@ | 230 | GNULIB_UTIMENSAT = @GNULIB_UTIMENSAT@ |
| 231 | GNULIB_WCTOMB = @GNULIB_WCTOMB@ | ||
| 228 | GNULIB_WRITE = @GNULIB_WRITE@ | 232 | GNULIB_WRITE = @GNULIB_WRITE@ |
| 229 | GNULIB__EXIT = @GNULIB__EXIT@ | 233 | GNULIB__EXIT = @GNULIB__EXIT@ |
| 230 | GNU_OBJC_CFLAGS = @GNU_OBJC_CFLAGS@ | 234 | GNU_OBJC_CFLAGS = @GNU_OBJC_CFLAGS@ |
| @@ -452,6 +456,7 @@ REPLACE_LOCALTIME_R = @REPLACE_LOCALTIME_R@ | |||
| 452 | REPLACE_LSEEK = @REPLACE_LSEEK@ | 456 | REPLACE_LSEEK = @REPLACE_LSEEK@ |
| 453 | REPLACE_LSTAT = @REPLACE_LSTAT@ | 457 | REPLACE_LSTAT = @REPLACE_LSTAT@ |
| 454 | REPLACE_MALLOC = @REPLACE_MALLOC@ | 458 | REPLACE_MALLOC = @REPLACE_MALLOC@ |
| 459 | REPLACE_MBTOWC = @REPLACE_MBTOWC@ | ||
| 455 | REPLACE_MKDIR = @REPLACE_MKDIR@ | 460 | REPLACE_MKDIR = @REPLACE_MKDIR@ |
| 456 | REPLACE_MKFIFO = @REPLACE_MKFIFO@ | 461 | REPLACE_MKFIFO = @REPLACE_MKFIFO@ |
| 457 | REPLACE_MKNOD = @REPLACE_MKNOD@ | 462 | REPLACE_MKNOD = @REPLACE_MKNOD@ |
| @@ -478,6 +483,7 @@ REPLACE_UNLINKAT = @REPLACE_UNLINKAT@ | |||
| 478 | REPLACE_UNSETENV = @REPLACE_UNSETENV@ | 483 | REPLACE_UNSETENV = @REPLACE_UNSETENV@ |
| 479 | REPLACE_USLEEP = @REPLACE_USLEEP@ | 484 | REPLACE_USLEEP = @REPLACE_USLEEP@ |
| 480 | REPLACE_UTIMENSAT = @REPLACE_UTIMENSAT@ | 485 | REPLACE_UTIMENSAT = @REPLACE_UTIMENSAT@ |
| 486 | REPLACE_WCTOMB = @REPLACE_WCTOMB@ | ||
| 481 | REPLACE_WRITE = @REPLACE_WRITE@ | 487 | REPLACE_WRITE = @REPLACE_WRITE@ |
| 482 | RSVG_CFLAGS = @RSVG_CFLAGS@ | 488 | RSVG_CFLAGS = @RSVG_CFLAGS@ |
| 483 | RSVG_LIBS = @RSVG_LIBS@ | 489 | RSVG_LIBS = @RSVG_LIBS@ |
| @@ -600,9 +606,10 @@ BUILT_SOURCES = arg-nonnull.h c++defs.h $(GETOPT_H) $(STDBOOL_H) \ | |||
| 600 | EXTRA_DIST = $(top_srcdir)/./arg-nonnull.h $(top_srcdir)/./c++defs.h \ | 606 | EXTRA_DIST = $(top_srcdir)/./arg-nonnull.h $(top_srcdir)/./c++defs.h \ |
| 601 | md5.c md5.h ftoastr.c ftoastr.h filemode.c filemode.h \ | 607 | md5.c md5.h ftoastr.c ftoastr.h filemode.c filemode.h \ |
| 602 | getloadavg.c getopt.c getopt.in.h getopt1.c getopt_int.h \ | 608 | getloadavg.c getopt.c getopt.in.h getopt1.c getopt_int.h \ |
| 603 | intprops.h mktime-internal.h mktime.c stdbool.in.h stddef.in.h \ | 609 | intprops.h lstat.c mktime-internal.h mktime.c readlink.c \ |
| 604 | stdint.in.h stdlib.in.h strftime.c strftime.h sys_stat.in.h \ | 610 | stat.c stdbool.in.h stddef.in.h stdint.in.h stdlib.in.h \ |
| 605 | time.in.h time_r.c unistd.in.h $(top_srcdir)/./warn-on-use.h | 611 | strftime.c strftime.h symlink.c sys_stat.in.h time.in.h \ |
| 612 | time_r.c unistd.in.h $(top_srcdir)/./warn-on-use.h | ||
| 606 | MOSTLYCLEANDIRS = sys | 613 | MOSTLYCLEANDIRS = sys |
| 607 | MOSTLYCLEANFILES = core *.stackdump arg-nonnull.h arg-nonnull.h-t \ | 614 | MOSTLYCLEANFILES = core *.stackdump arg-nonnull.h arg-nonnull.h-t \ |
| 608 | c++defs.h c++defs.h-t getopt.h getopt.h-t stdbool.h \ | 615 | c++defs.h c++defs.h-t getopt.h getopt.h-t stdbool.h \ |
| @@ -615,7 +622,8 @@ libgnu_a_SOURCES = dtoastr.c gettext.h ignore-value.h | |||
| 615 | libgnu_a_LIBADD = $(gl_LIBOBJS) | 622 | libgnu_a_LIBADD = $(gl_LIBOBJS) |
| 616 | libgnu_a_DEPENDENCIES = $(gl_LIBOBJS) | 623 | libgnu_a_DEPENDENCIES = $(gl_LIBOBJS) |
| 617 | EXTRA_libgnu_a_SOURCES = md5.c ftoastr.c filemode.c getloadavg.c \ | 624 | EXTRA_libgnu_a_SOURCES = md5.c ftoastr.c filemode.c getloadavg.c \ |
| 618 | getopt.c getopt1.c mktime.c strftime.c time_r.c | 625 | getopt.c getopt1.c lstat.c mktime.c readlink.c stat.c \ |
| 626 | strftime.c symlink.c time_r.c | ||
| 619 | ARG_NONNULL_H = arg-nonnull.h | 627 | ARG_NONNULL_H = arg-nonnull.h |
| 620 | CXXDEFS_H = c++defs.h | 628 | CXXDEFS_H = c++defs.h |
| 621 | WARN_ON_USE_H = warn-on-use.h | 629 | WARN_ON_USE_H = warn-on-use.h |
| @@ -674,9 +682,13 @@ distclean-compile: | |||
| 674 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getloadavg.Po@am__quote@ | 682 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getloadavg.Po@am__quote@ |
| 675 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt.Po@am__quote@ | 683 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt.Po@am__quote@ |
| 676 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt1.Po@am__quote@ | 684 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt1.Po@am__quote@ |
| 685 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lstat.Po@am__quote@ | ||
| 677 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/md5.Po@am__quote@ | 686 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/md5.Po@am__quote@ |
| 678 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mktime.Po@am__quote@ | 687 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mktime.Po@am__quote@ |
| 688 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/readlink.Po@am__quote@ | ||
| 689 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stat.Po@am__quote@ | ||
| 679 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strftime.Po@am__quote@ | 690 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strftime.Po@am__quote@ |
| 691 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/symlink.Po@am__quote@ | ||
| 680 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/time_r.Po@am__quote@ | 692 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/time_r.Po@am__quote@ |
| 681 | 693 | ||
| 682 | .c.o: | 694 | .c.o: |
| @@ -1001,6 +1013,7 @@ stdlib.h: stdlib.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) | |||
| 1001 | -e 's|@''GNULIB_GETSUBOPT''@|$(GNULIB_GETSUBOPT)|g' \ | 1013 | -e 's|@''GNULIB_GETSUBOPT''@|$(GNULIB_GETSUBOPT)|g' \ |
| 1002 | -e 's|@''GNULIB_GRANTPT''@|$(GNULIB_GRANTPT)|g' \ | 1014 | -e 's|@''GNULIB_GRANTPT''@|$(GNULIB_GRANTPT)|g' \ |
| 1003 | -e 's|@''GNULIB_MALLOC_POSIX''@|$(GNULIB_MALLOC_POSIX)|g' \ | 1015 | -e 's|@''GNULIB_MALLOC_POSIX''@|$(GNULIB_MALLOC_POSIX)|g' \ |
| 1016 | -e 's|@''GNULIB_MBTOWC''@|$(GNULIB_MBTOWC)|g' \ | ||
| 1004 | -e 's|@''GNULIB_MKDTEMP''@|$(GNULIB_MKDTEMP)|g' \ | 1017 | -e 's|@''GNULIB_MKDTEMP''@|$(GNULIB_MKDTEMP)|g' \ |
| 1005 | -e 's|@''GNULIB_MKOSTEMP''@|$(GNULIB_MKOSTEMP)|g' \ | 1018 | -e 's|@''GNULIB_MKOSTEMP''@|$(GNULIB_MKOSTEMP)|g' \ |
| 1006 | -e 's|@''GNULIB_MKOSTEMPS''@|$(GNULIB_MKOSTEMPS)|g' \ | 1019 | -e 's|@''GNULIB_MKOSTEMPS''@|$(GNULIB_MKOSTEMPS)|g' \ |
| @@ -1019,6 +1032,7 @@ stdlib.h: stdlib.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) | |||
| 1019 | -e 's|@''GNULIB_SYSTEM_POSIX''@|$(GNULIB_SYSTEM_POSIX)|g' \ | 1032 | -e 's|@''GNULIB_SYSTEM_POSIX''@|$(GNULIB_SYSTEM_POSIX)|g' \ |
| 1020 | -e 's|@''GNULIB_UNLOCKPT''@|$(GNULIB_UNLOCKPT)|g' \ | 1033 | -e 's|@''GNULIB_UNLOCKPT''@|$(GNULIB_UNLOCKPT)|g' \ |
| 1021 | -e 's|@''GNULIB_UNSETENV''@|$(GNULIB_UNSETENV)|g' \ | 1034 | -e 's|@''GNULIB_UNSETENV''@|$(GNULIB_UNSETENV)|g' \ |
| 1035 | -e 's|@''GNULIB_WCTOMB''@|$(GNULIB_WCTOMB)|g' \ | ||
| 1022 | < $(srcdir)/stdlib.in.h | \ | 1036 | < $(srcdir)/stdlib.in.h | \ |
| 1023 | sed -e 's|@''HAVE__EXIT''@|$(HAVE__EXIT)|g' \ | 1037 | sed -e 's|@''HAVE__EXIT''@|$(HAVE__EXIT)|g' \ |
| 1024 | -e 's|@''HAVE_ATOLL''@|$(HAVE_ATOLL)|g' \ | 1038 | -e 's|@''HAVE_ATOLL''@|$(HAVE_ATOLL)|g' \ |
| @@ -1047,6 +1061,7 @@ stdlib.h: stdlib.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) | |||
| 1047 | -e 's|@''REPLACE_CALLOC''@|$(REPLACE_CALLOC)|g' \ | 1061 | -e 's|@''REPLACE_CALLOC''@|$(REPLACE_CALLOC)|g' \ |
| 1048 | -e 's|@''REPLACE_CANONICALIZE_FILE_NAME''@|$(REPLACE_CANONICALIZE_FILE_NAME)|g' \ | 1062 | -e 's|@''REPLACE_CANONICALIZE_FILE_NAME''@|$(REPLACE_CANONICALIZE_FILE_NAME)|g' \ |
| 1049 | -e 's|@''REPLACE_MALLOC''@|$(REPLACE_MALLOC)|g' \ | 1063 | -e 's|@''REPLACE_MALLOC''@|$(REPLACE_MALLOC)|g' \ |
| 1064 | -e 's|@''REPLACE_MBTOWC''@|$(REPLACE_MBTOWC)|g' \ | ||
| 1050 | -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \ | 1065 | -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \ |
| 1051 | -e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \ | 1066 | -e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \ |
| 1052 | -e 's|@''REPLACE_REALLOC''@|$(REPLACE_REALLOC)|g' \ | 1067 | -e 's|@''REPLACE_REALLOC''@|$(REPLACE_REALLOC)|g' \ |
| @@ -1054,6 +1069,7 @@ stdlib.h: stdlib.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) | |||
| 1054 | -e 's|@''REPLACE_SETENV''@|$(REPLACE_SETENV)|g' \ | 1069 | -e 's|@''REPLACE_SETENV''@|$(REPLACE_SETENV)|g' \ |
| 1055 | -e 's|@''REPLACE_STRTOD''@|$(REPLACE_STRTOD)|g' \ | 1070 | -e 's|@''REPLACE_STRTOD''@|$(REPLACE_STRTOD)|g' \ |
| 1056 | -e 's|@''REPLACE_UNSETENV''@|$(REPLACE_UNSETENV)|g' \ | 1071 | -e 's|@''REPLACE_UNSETENV''@|$(REPLACE_UNSETENV)|g' \ |
| 1072 | -e 's|@''REPLACE_WCTOMB''@|$(REPLACE_WCTOMB)|g' \ | ||
| 1057 | -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ | 1073 | -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ |
| 1058 | -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ | 1074 | -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ |
| 1059 | -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \ | 1075 | -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \ |
diff --git a/lib/gnulib.mk b/lib/gnulib.mk index 32bf5714d17..1d918ff5fae 100644 --- a/lib/gnulib.mk +++ b/lib/gnulib.mk | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | # the same distribution terms as the rest of that program. | 9 | # the same distribution terms as the rest of that program. |
| 10 | # | 10 | # |
| 11 | # Generated by gnulib-tool. | 11 | # Generated by gnulib-tool. |
| 12 | # Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --makefile-name=gnulib.mk --no-libtool --macro-prefix=gl --no-vc-files crypto/md5 dtoastr filemode getloadavg getopt-gnu ignore-value mktime strftime sys_stat | 12 | # Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --makefile-name=gnulib.mk --no-libtool --macro-prefix=gl --no-vc-files crypto/md5 dtoastr filemode getloadavg getopt-gnu ignore-value lstat mktime readlink strftime symlink sys_stat |
| 13 | 13 | ||
| 14 | 14 | ||
| 15 | MOSTLYCLEANFILES += core *.stackdump | 15 | MOSTLYCLEANFILES += core *.stackdump |
| @@ -151,6 +151,15 @@ EXTRA_DIST += intprops.h | |||
| 151 | 151 | ||
| 152 | ## end gnulib module intprops | 152 | ## end gnulib module intprops |
| 153 | 153 | ||
| 154 | ## begin gnulib module lstat | ||
| 155 | |||
| 156 | |||
| 157 | EXTRA_DIST += lstat.c | ||
| 158 | |||
| 159 | EXTRA_libgnu_a_SOURCES += lstat.c | ||
| 160 | |||
| 161 | ## end gnulib module lstat | ||
| 162 | |||
| 154 | ## begin gnulib module mktime | 163 | ## begin gnulib module mktime |
| 155 | 164 | ||
| 156 | 165 | ||
| @@ -160,6 +169,24 @@ EXTRA_libgnu_a_SOURCES += mktime.c | |||
| 160 | 169 | ||
| 161 | ## end gnulib module mktime | 170 | ## end gnulib module mktime |
| 162 | 171 | ||
| 172 | ## begin gnulib module readlink | ||
| 173 | |||
| 174 | |||
| 175 | EXTRA_DIST += readlink.c | ||
| 176 | |||
| 177 | EXTRA_libgnu_a_SOURCES += readlink.c | ||
| 178 | |||
| 179 | ## end gnulib module readlink | ||
| 180 | |||
| 181 | ## begin gnulib module stat | ||
| 182 | |||
| 183 | |||
| 184 | EXTRA_DIST += stat.c | ||
| 185 | |||
| 186 | EXTRA_libgnu_a_SOURCES += stat.c | ||
| 187 | |||
| 188 | ## end gnulib module stat | ||
| 189 | |||
| 163 | ## begin gnulib module stdbool | 190 | ## begin gnulib module stdbool |
| 164 | 191 | ||
| 165 | BUILT_SOURCES += $(STDBOOL_H) | 192 | BUILT_SOURCES += $(STDBOOL_H) |
| @@ -267,6 +294,7 @@ stdlib.h: stdlib.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) | |||
| 267 | -e 's|@''GNULIB_GETSUBOPT''@|$(GNULIB_GETSUBOPT)|g' \ | 294 | -e 's|@''GNULIB_GETSUBOPT''@|$(GNULIB_GETSUBOPT)|g' \ |
| 268 | -e 's|@''GNULIB_GRANTPT''@|$(GNULIB_GRANTPT)|g' \ | 295 | -e 's|@''GNULIB_GRANTPT''@|$(GNULIB_GRANTPT)|g' \ |
| 269 | -e 's|@''GNULIB_MALLOC_POSIX''@|$(GNULIB_MALLOC_POSIX)|g' \ | 296 | -e 's|@''GNULIB_MALLOC_POSIX''@|$(GNULIB_MALLOC_POSIX)|g' \ |
| 297 | -e 's|@''GNULIB_MBTOWC''@|$(GNULIB_MBTOWC)|g' \ | ||
| 270 | -e 's|@''GNULIB_MKDTEMP''@|$(GNULIB_MKDTEMP)|g' \ | 298 | -e 's|@''GNULIB_MKDTEMP''@|$(GNULIB_MKDTEMP)|g' \ |
| 271 | -e 's|@''GNULIB_MKOSTEMP''@|$(GNULIB_MKOSTEMP)|g' \ | 299 | -e 's|@''GNULIB_MKOSTEMP''@|$(GNULIB_MKOSTEMP)|g' \ |
| 272 | -e 's|@''GNULIB_MKOSTEMPS''@|$(GNULIB_MKOSTEMPS)|g' \ | 300 | -e 's|@''GNULIB_MKOSTEMPS''@|$(GNULIB_MKOSTEMPS)|g' \ |
| @@ -285,6 +313,7 @@ stdlib.h: stdlib.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) | |||
| 285 | -e 's|@''GNULIB_SYSTEM_POSIX''@|$(GNULIB_SYSTEM_POSIX)|g' \ | 313 | -e 's|@''GNULIB_SYSTEM_POSIX''@|$(GNULIB_SYSTEM_POSIX)|g' \ |
| 286 | -e 's|@''GNULIB_UNLOCKPT''@|$(GNULIB_UNLOCKPT)|g' \ | 314 | -e 's|@''GNULIB_UNLOCKPT''@|$(GNULIB_UNLOCKPT)|g' \ |
| 287 | -e 's|@''GNULIB_UNSETENV''@|$(GNULIB_UNSETENV)|g' \ | 315 | -e 's|@''GNULIB_UNSETENV''@|$(GNULIB_UNSETENV)|g' \ |
| 316 | -e 's|@''GNULIB_WCTOMB''@|$(GNULIB_WCTOMB)|g' \ | ||
| 288 | < $(srcdir)/stdlib.in.h | \ | 317 | < $(srcdir)/stdlib.in.h | \ |
| 289 | sed -e 's|@''HAVE__EXIT''@|$(HAVE__EXIT)|g' \ | 318 | sed -e 's|@''HAVE__EXIT''@|$(HAVE__EXIT)|g' \ |
| 290 | -e 's|@''HAVE_ATOLL''@|$(HAVE_ATOLL)|g' \ | 319 | -e 's|@''HAVE_ATOLL''@|$(HAVE_ATOLL)|g' \ |
| @@ -313,6 +342,7 @@ stdlib.h: stdlib.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) | |||
| 313 | -e 's|@''REPLACE_CALLOC''@|$(REPLACE_CALLOC)|g' \ | 342 | -e 's|@''REPLACE_CALLOC''@|$(REPLACE_CALLOC)|g' \ |
| 314 | -e 's|@''REPLACE_CANONICALIZE_FILE_NAME''@|$(REPLACE_CANONICALIZE_FILE_NAME)|g' \ | 343 | -e 's|@''REPLACE_CANONICALIZE_FILE_NAME''@|$(REPLACE_CANONICALIZE_FILE_NAME)|g' \ |
| 315 | -e 's|@''REPLACE_MALLOC''@|$(REPLACE_MALLOC)|g' \ | 344 | -e 's|@''REPLACE_MALLOC''@|$(REPLACE_MALLOC)|g' \ |
| 345 | -e 's|@''REPLACE_MBTOWC''@|$(REPLACE_MBTOWC)|g' \ | ||
| 316 | -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \ | 346 | -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \ |
| 317 | -e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \ | 347 | -e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \ |
| 318 | -e 's|@''REPLACE_REALLOC''@|$(REPLACE_REALLOC)|g' \ | 348 | -e 's|@''REPLACE_REALLOC''@|$(REPLACE_REALLOC)|g' \ |
| @@ -320,6 +350,7 @@ stdlib.h: stdlib.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) | |||
| 320 | -e 's|@''REPLACE_SETENV''@|$(REPLACE_SETENV)|g' \ | 350 | -e 's|@''REPLACE_SETENV''@|$(REPLACE_SETENV)|g' \ |
| 321 | -e 's|@''REPLACE_STRTOD''@|$(REPLACE_STRTOD)|g' \ | 351 | -e 's|@''REPLACE_STRTOD''@|$(REPLACE_STRTOD)|g' \ |
| 322 | -e 's|@''REPLACE_UNSETENV''@|$(REPLACE_UNSETENV)|g' \ | 352 | -e 's|@''REPLACE_UNSETENV''@|$(REPLACE_UNSETENV)|g' \ |
| 353 | -e 's|@''REPLACE_WCTOMB''@|$(REPLACE_WCTOMB)|g' \ | ||
| 323 | -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ | 354 | -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ |
| 324 | -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ | 355 | -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ |
| 325 | -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \ | 356 | -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \ |
| @@ -340,6 +371,15 @@ EXTRA_libgnu_a_SOURCES += strftime.c | |||
| 340 | 371 | ||
| 341 | ## end gnulib module strftime | 372 | ## end gnulib module strftime |
| 342 | 373 | ||
| 374 | ## begin gnulib module symlink | ||
| 375 | |||
| 376 | |||
| 377 | EXTRA_DIST += symlink.c | ||
| 378 | |||
| 379 | EXTRA_libgnu_a_SOURCES += symlink.c | ||
| 380 | |||
| 381 | ## end gnulib module symlink | ||
| 382 | |||
| 343 | ## begin gnulib module sys_stat | 383 | ## begin gnulib module sys_stat |
| 344 | 384 | ||
| 345 | BUILT_SOURCES += sys/stat.h | 385 | BUILT_SOURCES += sys/stat.h |
diff --git a/lib/lstat.c b/lib/lstat.c new file mode 100644 index 00000000000..b26065ede28 --- /dev/null +++ b/lib/lstat.c | |||
| @@ -0,0 +1,91 @@ | |||
| 1 | /* Work around a bug of lstat on some systems | ||
| 2 | |||
| 3 | Copyright (C) 1997-2006, 2008-2011 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | This program is free software: you can redistribute it and/or modify | ||
| 6 | it under the terms of the GNU General Public License as published by | ||
| 7 | the Free Software Foundation; either version 3 of the License, or | ||
| 8 | (at your option) any later version. | ||
| 9 | |||
| 10 | This program is distributed in the hope that it will be useful, | ||
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | GNU General Public License for more details. | ||
| 14 | |||
| 15 | You should have received a copy of the GNU General Public License | ||
| 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | ||
| 17 | |||
| 18 | /* written by Jim Meyering */ | ||
| 19 | |||
| 20 | #include <config.h> | ||
| 21 | |||
| 22 | #if !HAVE_LSTAT | ||
| 23 | /* On systems that lack symlinks, our replacement <sys/stat.h> already | ||
| 24 | defined lstat as stat, so there is nothing further to do other than | ||
| 25 | avoid an empty file. */ | ||
| 26 | typedef int dummy; | ||
| 27 | #else /* HAVE_LSTAT */ | ||
| 28 | |||
| 29 | /* Get the original definition of lstat. It might be defined as a macro. */ | ||
| 30 | # define __need_system_sys_stat_h | ||
| 31 | # include <sys/types.h> | ||
| 32 | # include <sys/stat.h> | ||
| 33 | # undef __need_system_sys_stat_h | ||
| 34 | |||
| 35 | static inline int | ||
| 36 | orig_lstat (const char *filename, struct stat *buf) | ||
| 37 | { | ||
| 38 | return lstat (filename, buf); | ||
| 39 | } | ||
| 40 | |||
| 41 | /* Specification. */ | ||
| 42 | # include <sys/stat.h> | ||
| 43 | |||
| 44 | # include <string.h> | ||
| 45 | # include <errno.h> | ||
| 46 | |||
| 47 | /* lstat works differently on Linux and Solaris systems. POSIX (see | ||
| 48 | `pathname resolution' in the glossary) requires that programs like | ||
| 49 | `ls' take into consideration the fact that FILE has a trailing slash | ||
| 50 | when FILE is a symbolic link. On Linux and Solaris 10 systems, the | ||
| 51 | lstat function already has the desired semantics (in treating | ||
| 52 | `lstat ("symlink/", sbuf)' just like `lstat ("symlink/.", sbuf)', | ||
| 53 | but on Solaris 9 and earlier it does not. | ||
| 54 | |||
| 55 | If FILE has a trailing slash and specifies a symbolic link, | ||
| 56 | then use stat() to get more info on the referent of FILE. | ||
| 57 | If the referent is a non-directory, then set errno to ENOTDIR | ||
| 58 | and return -1. Otherwise, return stat's result. */ | ||
| 59 | |||
| 60 | int | ||
| 61 | rpl_lstat (const char *file, struct stat *sbuf) | ||
| 62 | { | ||
| 63 | size_t len; | ||
| 64 | int lstat_result = orig_lstat (file, sbuf); | ||
| 65 | |||
| 66 | if (lstat_result != 0) | ||
| 67 | return lstat_result; | ||
| 68 | |||
| 69 | /* This replacement file can blindly check against '/' rather than | ||
| 70 | using the ISSLASH macro, because all platforms with '\\' either | ||
| 71 | lack symlinks (mingw) or have working lstat (cygwin) and thus do | ||
| 72 | not compile this file. 0 len should have already been filtered | ||
| 73 | out above, with a failure return of ENOENT. */ | ||
| 74 | len = strlen (file); | ||
| 75 | if (file[len - 1] != '/' || S_ISDIR (sbuf->st_mode)) | ||
| 76 | return 0; | ||
| 77 | |||
| 78 | /* At this point, a trailing slash is only permitted on | ||
| 79 | symlink-to-dir; but it should have found information on the | ||
| 80 | directory, not the symlink. Call stat() to get info about the | ||
| 81 | link's referent. Our replacement stat guarantees valid results, | ||
| 82 | even if the symlink is not pointing to a directory. */ | ||
| 83 | if (!S_ISLNK (sbuf->st_mode)) | ||
| 84 | { | ||
| 85 | errno = ENOTDIR; | ||
| 86 | return -1; | ||
| 87 | } | ||
| 88 | return stat (file, sbuf); | ||
| 89 | } | ||
| 90 | |||
| 91 | #endif /* HAVE_LSTAT */ | ||
diff --git a/lib/readlink.c b/lib/readlink.c new file mode 100644 index 00000000000..35d045b9a12 --- /dev/null +++ b/lib/readlink.c | |||
| @@ -0,0 +1,74 @@ | |||
| 1 | /* Stub for readlink(). | ||
| 2 | Copyright (C) 2003-2007, 2009-2011 Free Software Foundation, Inc. | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation; either version 3 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | ||
| 16 | |||
| 17 | #include <config.h> | ||
| 18 | |||
| 19 | /* Specification. */ | ||
| 20 | #include <unistd.h> | ||
| 21 | |||
| 22 | #include <errno.h> | ||
| 23 | #include <string.h> | ||
| 24 | #include <sys/stat.h> | ||
| 25 | |||
| 26 | #if !HAVE_READLINK | ||
| 27 | |||
| 28 | /* readlink() substitute for systems that don't have a readlink() function, | ||
| 29 | such as DJGPP 2.03 and mingw32. */ | ||
| 30 | |||
| 31 | ssize_t | ||
| 32 | readlink (const char *name, char *buf _GL_UNUSED, | ||
| 33 | size_t bufsize _GL_UNUSED) | ||
| 34 | { | ||
| 35 | struct stat statbuf; | ||
| 36 | |||
| 37 | /* In general we should use lstat() here, not stat(). But on platforms | ||
| 38 | without symbolic links, lstat() - if it exists - would be equivalent to | ||
| 39 | stat(), therefore we can use stat(). This saves us a configure check. */ | ||
| 40 | if (stat (name, &statbuf) >= 0) | ||
| 41 | errno = EINVAL; | ||
| 42 | return -1; | ||
| 43 | } | ||
| 44 | |||
| 45 | #else /* HAVE_READLINK */ | ||
| 46 | |||
| 47 | # undef readlink | ||
| 48 | |||
| 49 | /* readlink() wrapper that uses correct types, for systems like cygwin | ||
| 50 | 1.5.x where readlink returns int, and which rejects trailing slash, | ||
| 51 | for Solaris 9. */ | ||
| 52 | |||
| 53 | ssize_t | ||
| 54 | rpl_readlink (const char *name, char *buf, size_t bufsize) | ||
| 55 | { | ||
| 56 | # if READLINK_TRAILING_SLASH_BUG | ||
| 57 | size_t len = strlen (name); | ||
| 58 | if (len && name[len - 1] == '/') | ||
| 59 | { | ||
| 60 | /* Even if name without the slash is a symlink to a directory, | ||
| 61 | both lstat() and stat() must resolve the trailing slash to | ||
| 62 | the directory rather than the symlink. We can therefore | ||
| 63 | safely use stat() to distinguish between EINVAL and | ||
| 64 | ENOTDIR/ENOENT, avoiding extra overhead of rpl_lstat(). */ | ||
| 65 | struct stat st; | ||
| 66 | if (stat (name, &st) == 0) | ||
| 67 | errno = EINVAL; | ||
| 68 | return -1; | ||
| 69 | } | ||
| 70 | # endif /* READLINK_TRAILING_SLASH_BUG */ | ||
| 71 | return readlink (name, buf, bufsize); | ||
| 72 | } | ||
| 73 | |||
| 74 | #endif /* HAVE_READLINK */ | ||
diff --git a/lib/stat.c b/lib/stat.c new file mode 100644 index 00000000000..f16d9144afc --- /dev/null +++ b/lib/stat.c | |||
| @@ -0,0 +1,104 @@ | |||
| 1 | /* Work around platform bugs in stat. | ||
| 2 | Copyright (C) 2009-2011 Free Software Foundation, Inc. | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation; either version 3 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | ||
| 16 | |||
| 17 | /* written by Eric Blake */ | ||
| 18 | |||
| 19 | #include <config.h> | ||
| 20 | |||
| 21 | /* Get the original definition of stat. It might be defined as a macro. */ | ||
| 22 | #define __need_system_sys_stat_h | ||
| 23 | #include <sys/types.h> | ||
| 24 | #include <sys/stat.h> | ||
| 25 | #undef __need_system_sys_stat_h | ||
| 26 | |||
| 27 | static inline int | ||
| 28 | orig_stat (const char *filename, struct stat *buf) | ||
| 29 | { | ||
| 30 | return stat (filename, buf); | ||
| 31 | } | ||
| 32 | |||
| 33 | /* Specification. */ | ||
| 34 | #include <sys/stat.h> | ||
| 35 | |||
| 36 | #include <errno.h> | ||
| 37 | #include <limits.h> | ||
| 38 | #include <stdbool.h> | ||
| 39 | #include <string.h> | ||
| 40 | |||
| 41 | /* Store information about NAME into ST. Work around bugs with | ||
| 42 | trailing slashes. Mingw has other bugs (such as st_ino always | ||
| 43 | being 0 on success) which this wrapper does not work around. But | ||
| 44 | at least this implementation provides the ability to emulate fchdir | ||
| 45 | correctly. */ | ||
| 46 | |||
| 47 | int | ||
| 48 | rpl_stat (char const *name, struct stat *st) | ||
| 49 | { | ||
| 50 | int result = orig_stat (name, st); | ||
| 51 | #if REPLACE_FUNC_STAT_FILE | ||
| 52 | /* Solaris 9 mistakenly succeeds when given a non-directory with a | ||
| 53 | trailing slash. */ | ||
| 54 | if (result == 0 && !S_ISDIR (st->st_mode)) | ||
| 55 | { | ||
| 56 | size_t len = strlen (name); | ||
| 57 | if (ISSLASH (name[len - 1])) | ||
| 58 | { | ||
| 59 | errno = ENOTDIR; | ||
| 60 | return -1; | ||
| 61 | } | ||
| 62 | } | ||
| 63 | #endif /* REPLACE_FUNC_STAT_FILE */ | ||
| 64 | #if REPLACE_FUNC_STAT_DIR | ||
| 65 | if (result == -1 && errno == ENOENT) | ||
| 66 | { | ||
| 67 | /* Due to mingw's oddities, there are some directories (like | ||
| 68 | c:\) where stat() only succeeds with a trailing slash, and | ||
| 69 | other directories (like c:\windows) where stat() only | ||
| 70 | succeeds without a trailing slash. But we want the two to be | ||
| 71 | synonymous, since chdir() manages either style. Likewise, Mingw also | ||
| 72 | reports ENOENT for names longer than PATH_MAX, when we want | ||
| 73 | ENAMETOOLONG, and for stat("file/"), when we want ENOTDIR. | ||
| 74 | Fortunately, mingw PATH_MAX is small enough for stack | ||
| 75 | allocation. */ | ||
| 76 | char fixed_name[PATH_MAX + 1] = {0}; | ||
| 77 | size_t len = strlen (name); | ||
| 78 | bool check_dir = false; | ||
| 79 | if (PATH_MAX <= len) | ||
| 80 | errno = ENAMETOOLONG; | ||
| 81 | else if (len) | ||
| 82 | { | ||
| 83 | strcpy (fixed_name, name); | ||
| 84 | if (ISSLASH (fixed_name[len - 1])) | ||
| 85 | { | ||
| 86 | check_dir = true; | ||
| 87 | while (len && ISSLASH (fixed_name[len - 1])) | ||
| 88 | fixed_name[--len] = '\0'; | ||
| 89 | if (!len) | ||
| 90 | fixed_name[0] = '/'; | ||
| 91 | } | ||
| 92 | else | ||
| 93 | fixed_name[len++] = '/'; | ||
| 94 | result = orig_stat (fixed_name, st); | ||
| 95 | if (result == 0 && check_dir && !S_ISDIR (st->st_mode)) | ||
| 96 | { | ||
| 97 | result = -1; | ||
| 98 | errno = ENOTDIR; | ||
| 99 | } | ||
| 100 | } | ||
| 101 | } | ||
| 102 | #endif /* REPLACE_FUNC_STAT_DIR */ | ||
| 103 | return result; | ||
| 104 | } | ||
diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h index 62d18c62811..2697a4bd1db 100644 --- a/lib/stdlib.in.h +++ b/lib/stdlib.in.h | |||
| @@ -274,6 +274,21 @@ _GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - " | |||
| 274 | "use gnulib module malloc-posix for portability"); | 274 | "use gnulib module malloc-posix for portability"); |
| 275 | #endif | 275 | #endif |
| 276 | 276 | ||
| 277 | /* Convert a multibyte character to a wide character. */ | ||
| 278 | #if @GNULIB_MBTOWC@ | ||
| 279 | # if @REPLACE_MBTOWC@ | ||
| 280 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 281 | # undef mbtowc | ||
| 282 | # define mbtowc rpl_mbtowc | ||
| 283 | # endif | ||
| 284 | _GL_FUNCDECL_RPL (mbtowc, int, (wchar_t *pwc, const char *s, size_t n)); | ||
| 285 | _GL_CXXALIAS_RPL (mbtowc, int, (wchar_t *pwc, const char *s, size_t n)); | ||
| 286 | # else | ||
| 287 | _GL_CXXALIAS_SYS (mbtowc, int, (wchar_t *pwc, const char *s, size_t n)); | ||
| 288 | # endif | ||
| 289 | _GL_CXXALIASWARN (mbtowc); | ||
| 290 | #endif | ||
| 291 | |||
| 277 | #if @GNULIB_MKDTEMP@ | 292 | #if @GNULIB_MKDTEMP@ |
| 278 | /* Create a unique temporary directory from TEMPLATE. | 293 | /* Create a unique temporary directory from TEMPLATE. |
| 279 | The last six characters of TEMPLATE must be "XXXXXX"; | 294 | The last six characters of TEMPLATE must be "XXXXXX"; |
| @@ -723,6 +738,21 @@ _GL_WARN_ON_USE (unsetenv, "unsetenv is unportable - " | |||
| 723 | # endif | 738 | # endif |
| 724 | #endif | 739 | #endif |
| 725 | 740 | ||
| 741 | /* Convert a wide character to a multibyte character. */ | ||
| 742 | #if @GNULIB_WCTOMB@ | ||
| 743 | # if @REPLACE_WCTOMB@ | ||
| 744 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 745 | # undef wctomb | ||
| 746 | # define wctomb rpl_wctomb | ||
| 747 | # endif | ||
| 748 | _GL_FUNCDECL_RPL (wctomb, int, (char *s, wchar_t wc)); | ||
| 749 | _GL_CXXALIAS_RPL (wctomb, int, (char *s, wchar_t wc)); | ||
| 750 | # else | ||
| 751 | _GL_CXXALIAS_SYS (wctomb, int, (char *s, wchar_t wc)); | ||
| 752 | # endif | ||
| 753 | _GL_CXXALIASWARN (wctomb); | ||
| 754 | #endif | ||
| 755 | |||
| 726 | 756 | ||
| 727 | #endif /* _GL_STDLIB_H */ | 757 | #endif /* _GL_STDLIB_H */ |
| 728 | #endif /* _GL_STDLIB_H */ | 758 | #endif /* _GL_STDLIB_H */ |
diff --git a/lib/symlink.c b/lib/symlink.c new file mode 100644 index 00000000000..2896cc9655b --- /dev/null +++ b/lib/symlink.c | |||
| @@ -0,0 +1,57 @@ | |||
| 1 | /* Stub for symlink(). | ||
| 2 | Copyright (C) 2009-2011 Free Software Foundation, Inc. | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation; either version 3 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | ||
| 16 | |||
| 17 | #include <config.h> | ||
| 18 | |||
| 19 | /* Specification. */ | ||
| 20 | #include <unistd.h> | ||
| 21 | |||
| 22 | #include <errno.h> | ||
| 23 | #include <string.h> | ||
| 24 | #include <sys/stat.h> | ||
| 25 | |||
| 26 | |||
| 27 | #if HAVE_SYMLINK | ||
| 28 | |||
| 29 | # undef symlink | ||
| 30 | |||
| 31 | /* Create a symlink, but reject trailing slash. */ | ||
| 32 | int | ||
| 33 | rpl_symlink (char const *contents, char const *name) | ||
| 34 | { | ||
| 35 | size_t len = strlen (name); | ||
| 36 | if (len && name[len - 1] == '/') | ||
| 37 | { | ||
| 38 | struct stat st; | ||
| 39 | if (lstat (name, &st) == 0) | ||
| 40 | errno = EEXIST; | ||
| 41 | return -1; | ||
| 42 | } | ||
| 43 | return symlink (contents, name); | ||
| 44 | } | ||
| 45 | |||
| 46 | #else /* !HAVE_SYMLINK */ | ||
| 47 | |||
| 48 | /* The system does not support symlinks. */ | ||
| 49 | int | ||
| 50 | symlink (char const *contents _GL_UNUSED, | ||
| 51 | char const *name _GL_UNUSED) | ||
| 52 | { | ||
| 53 | errno = ENOSYS; | ||
| 54 | return -1; | ||
| 55 | } | ||
| 56 | |||
| 57 | #endif /* !HAVE_SYMLINK */ | ||
diff --git a/m4/dos.m4 b/m4/dos.m4 new file mode 100644 index 00000000000..ed9c4cee670 --- /dev/null +++ b/m4/dos.m4 | |||
| @@ -0,0 +1,71 @@ | |||
| 1 | #serial 11 -*- 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-2006, 2009-2011 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 | |||
| 13 | AC_DEFUN([gl_AC_DOS], | ||
| 14 | [ | ||
| 15 | AC_CACHE_CHECK([whether system is Windows or MSDOS], [ac_cv_win_or_dos], | ||
| 16 | [ | ||
| 17 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[ | ||
| 18 | #if !defined _WIN32 && !defined __WIN32__ && !defined __MSDOS__ && !defined __CYGWIN__ | ||
| 19 | neither 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_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[ | ||
| 32 | #if defined __CYGWIN__ | ||
| 33 | drive 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 | ]) | ||
diff --git a/m4/gl-comp.m4 b/m4/gl-comp.m4 index 10ec34da386..c495389af8f 100644 --- a/m4/gl-comp.m4 +++ b/m4/gl-comp.m4 | |||
| @@ -40,13 +40,17 @@ AC_DEFUN([gl_EARLY], | |||
| 40 | # Code from module ignore-value: | 40 | # Code from module ignore-value: |
| 41 | # Code from module include_next: | 41 | # Code from module include_next: |
| 42 | # Code from module intprops: | 42 | # Code from module intprops: |
| 43 | # Code from module lstat: | ||
| 43 | # Code from module mktime: | 44 | # Code from module mktime: |
| 44 | # Code from module multiarch: | 45 | # Code from module multiarch: |
| 46 | # Code from module readlink: | ||
| 47 | # Code from module stat: | ||
| 45 | # Code from module stdbool: | 48 | # Code from module stdbool: |
| 46 | # Code from module stddef: | 49 | # Code from module stddef: |
| 47 | # Code from module stdint: | 50 | # Code from module stdint: |
| 48 | # Code from module stdlib: | 51 | # Code from module stdlib: |
| 49 | # Code from module strftime: | 52 | # Code from module strftime: |
| 53 | # Code from module symlink: | ||
| 50 | # Code from module sys_stat: | 54 | # Code from module sys_stat: |
| 51 | # Code from module time: | 55 | # Code from module time: |
| 52 | # Code from module time_r: | 56 | # Code from module time_r: |
| @@ -94,11 +98,20 @@ AC_DEFUN([gl_INIT], | |||
| 94 | AC_REQUIRE([AC_C_INLINE]) | 98 | AC_REQUIRE([AC_C_INLINE]) |
| 95 | # Code from module include_next: | 99 | # Code from module include_next: |
| 96 | # Code from module intprops: | 100 | # Code from module intprops: |
| 101 | # Code from module lstat: | ||
| 102 | gl_FUNC_LSTAT | ||
| 103 | gl_SYS_STAT_MODULE_INDICATOR([lstat]) | ||
| 97 | # Code from module mktime: | 104 | # Code from module mktime: |
| 98 | gl_FUNC_MKTIME | 105 | gl_FUNC_MKTIME |
| 99 | gl_TIME_MODULE_INDICATOR([mktime]) | 106 | gl_TIME_MODULE_INDICATOR([mktime]) |
| 100 | # Code from module multiarch: | 107 | # Code from module multiarch: |
| 101 | gl_MULTIARCH | 108 | gl_MULTIARCH |
| 109 | # Code from module readlink: | ||
| 110 | gl_FUNC_READLINK | ||
| 111 | gl_UNISTD_MODULE_INDICATOR([readlink]) | ||
| 112 | # Code from module stat: | ||
| 113 | gl_FUNC_STAT | ||
| 114 | gl_SYS_STAT_MODULE_INDICATOR([stat]) | ||
| 102 | # Code from module stdbool: | 115 | # Code from module stdbool: |
| 103 | AM_STDBOOL_H | 116 | AM_STDBOOL_H |
| 104 | # Code from module stddef: | 117 | # Code from module stddef: |
| @@ -109,6 +122,9 @@ AC_DEFUN([gl_INIT], | |||
| 109 | gl_STDLIB_H | 122 | gl_STDLIB_H |
| 110 | # Code from module strftime: | 123 | # Code from module strftime: |
| 111 | gl_FUNC_GNU_STRFTIME | 124 | gl_FUNC_GNU_STRFTIME |
| 125 | # Code from module symlink: | ||
| 126 | gl_FUNC_SYMLINK | ||
| 127 | gl_UNISTD_MODULE_INDICATOR([symlink]) | ||
| 112 | # Code from module sys_stat: | 128 | # Code from module sys_stat: |
| 113 | gl_HEADER_SYS_STAT_H | 129 | gl_HEADER_SYS_STAT_H |
| 114 | AC_PROG_MKDIR_P | 130 | AC_PROG_MKDIR_P |
| @@ -276,22 +292,27 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 276 | lib/gettext.h | 292 | lib/gettext.h |
| 277 | lib/ignore-value.h | 293 | lib/ignore-value.h |
| 278 | lib/intprops.h | 294 | lib/intprops.h |
| 295 | lib/lstat.c | ||
| 279 | lib/md5.c | 296 | lib/md5.c |
| 280 | lib/md5.h | 297 | lib/md5.h |
| 281 | lib/mktime-internal.h | 298 | lib/mktime-internal.h |
| 282 | lib/mktime.c | 299 | lib/mktime.c |
| 300 | lib/readlink.c | ||
| 301 | lib/stat.c | ||
| 283 | lib/stdbool.in.h | 302 | lib/stdbool.in.h |
| 284 | lib/stddef.in.h | 303 | lib/stddef.in.h |
| 285 | lib/stdint.in.h | 304 | lib/stdint.in.h |
| 286 | lib/stdlib.in.h | 305 | lib/stdlib.in.h |
| 287 | lib/strftime.c | 306 | lib/strftime.c |
| 288 | lib/strftime.h | 307 | lib/strftime.h |
| 308 | lib/symlink.c | ||
| 289 | lib/sys_stat.in.h | 309 | lib/sys_stat.in.h |
| 290 | lib/time.in.h | 310 | lib/time.in.h |
| 291 | lib/time_r.c | 311 | lib/time_r.c |
| 292 | lib/unistd.in.h | 312 | lib/unistd.in.h |
| 293 | m4/00gnulib.m4 | 313 | m4/00gnulib.m4 |
| 294 | m4/c-strtod.m4 | 314 | m4/c-strtod.m4 |
| 315 | m4/dos.m4 | ||
| 295 | m4/extensions.m4 | 316 | m4/extensions.m4 |
| 296 | m4/filemode.m4 | 317 | m4/filemode.m4 |
| 297 | m4/getloadavg.m4 | 318 | m4/getloadavg.m4 |
| @@ -299,15 +320,19 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 299 | m4/gnulib-common.m4 | 320 | m4/gnulib-common.m4 |
| 300 | m4/include_next.m4 | 321 | m4/include_next.m4 |
| 301 | m4/longlong.m4 | 322 | m4/longlong.m4 |
| 323 | m4/lstat.m4 | ||
| 302 | m4/md5.m4 | 324 | m4/md5.m4 |
| 303 | m4/mktime.m4 | 325 | m4/mktime.m4 |
| 304 | m4/multiarch.m4 | 326 | m4/multiarch.m4 |
| 327 | m4/readlink.m4 | ||
| 305 | m4/st_dm_mode.m4 | 328 | m4/st_dm_mode.m4 |
| 329 | m4/stat.m4 | ||
| 306 | m4/stdbool.m4 | 330 | m4/stdbool.m4 |
| 307 | m4/stddef_h.m4 | 331 | m4/stddef_h.m4 |
| 308 | m4/stdint.m4 | 332 | m4/stdint.m4 |
| 309 | m4/stdlib_h.m4 | 333 | m4/stdlib_h.m4 |
| 310 | m4/strftime.m4 | 334 | m4/strftime.m4 |
| 335 | m4/symlink.m4 | ||
| 311 | m4/sys_stat_h.m4 | 336 | m4/sys_stat_h.m4 |
| 312 | m4/time_h.m4 | 337 | m4/time_h.m4 |
| 313 | m4/time_r.m4 | 338 | m4/time_r.m4 |
diff --git a/m4/lstat.m4 b/m4/lstat.m4 new file mode 100644 index 00000000000..b9b22a6b20e --- /dev/null +++ b/m4/lstat.m4 | |||
| @@ -0,0 +1,69 @@ | |||
| 1 | # serial 21 | ||
| 2 | |||
| 3 | # Copyright (C) 1997-2001, 2003-2011 Free Software Foundation, Inc. | ||
| 4 | # | ||
| 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 | |||
| 9 | dnl From Jim Meyering. | ||
| 10 | |||
| 11 | AC_DEFUN([gl_FUNC_LSTAT], | ||
| 12 | [ | ||
| 13 | AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) | ||
| 14 | dnl If lstat does not exist, the replacement <sys/stat.h> does | ||
| 15 | dnl "#define lstat stat", and lstat.c is a no-op. | ||
| 16 | AC_CHECK_FUNCS_ONCE([lstat]) | ||
| 17 | if test $ac_cv_func_lstat = yes; then | ||
| 18 | AC_REQUIRE([AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK]) | ||
| 19 | if test $ac_cv_func_lstat_dereferences_slashed_symlink = no; then | ||
| 20 | dnl Note: AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK does AC_LIBOBJ([lstat]). | ||
| 21 | REPLACE_LSTAT=1 | ||
| 22 | fi | ||
| 23 | # Prerequisites of lib/lstat.c. | ||
| 24 | AC_REQUIRE([AC_C_INLINE]) | ||
| 25 | else | ||
| 26 | HAVE_LSTAT=0 | ||
| 27 | fi | ||
| 28 | ]) | ||
| 29 | |||
| 30 | # Redefine AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK, because it is no longer | ||
| 31 | # maintained in Autoconf. | ||
| 32 | AC_DEFUN([AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK], | ||
| 33 | [ | ||
| 34 | AC_CACHE_CHECK([whether lstat correctly handles trailing slash], | ||
| 35 | [ac_cv_func_lstat_dereferences_slashed_symlink], | ||
| 36 | [rm -f conftest.sym conftest.file | ||
| 37 | echo >conftest.file | ||
| 38 | if test "$as_ln_s" = "ln -s" && ln -s conftest.file conftest.sym; then | ||
| 39 | AC_RUN_IFELSE( | ||
| 40 | [AC_LANG_PROGRAM( | ||
| 41 | [AC_INCLUDES_DEFAULT], | ||
| 42 | [[struct stat sbuf; | ||
| 43 | /* Linux will dereference the symlink and fail, as required by | ||
| 44 | POSIX. That is better in the sense that it means we will not | ||
| 45 | have to compile and use the lstat wrapper. */ | ||
| 46 | return lstat ("conftest.sym/", &sbuf) == 0; | ||
| 47 | ]])], | ||
| 48 | [ac_cv_func_lstat_dereferences_slashed_symlink=yes], | ||
| 49 | [ac_cv_func_lstat_dereferences_slashed_symlink=no], | ||
| 50 | [# When cross-compiling, be pessimistic so we will end up using the | ||
| 51 | # replacement version of lstat that checks for trailing slashes and | ||
| 52 | # calls lstat a second time when necessary. | ||
| 53 | ac_cv_func_lstat_dereferences_slashed_symlink=no | ||
| 54 | ]) | ||
| 55 | else | ||
| 56 | # If the 'ln -s' command failed, then we probably don't even | ||
| 57 | # have an lstat function. | ||
| 58 | ac_cv_func_lstat_dereferences_slashed_symlink=no | ||
| 59 | fi | ||
| 60 | rm -f conftest.sym conftest.file | ||
| 61 | ]) | ||
| 62 | test $ac_cv_func_lstat_dereferences_slashed_symlink = yes && | ||
| 63 | AC_DEFINE_UNQUOTED([LSTAT_FOLLOWS_SLASHED_SYMLINK], [1], | ||
| 64 | [Define to 1 if `lstat' dereferences a symlink specified | ||
| 65 | with a trailing slash.]) | ||
| 66 | if test "x$ac_cv_func_lstat_dereferences_slashed_symlink" = xno; then | ||
| 67 | AC_LIBOBJ([lstat]) | ||
| 68 | fi | ||
| 69 | ]) | ||
diff --git a/m4/readlink.m4 b/m4/readlink.m4 new file mode 100644 index 00000000000..a502ca560fe --- /dev/null +++ b/m4/readlink.m4 | |||
| @@ -0,0 +1,62 @@ | |||
| 1 | # readlink.m4 serial 9 | ||
| 2 | dnl Copyright (C) 2003, 2007, 2009-2011 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | ||
| 4 | dnl gives unlimited permission to copy and/or distribute it, | ||
| 5 | dnl with or without modifications, as long as this notice is preserved. | ||
| 6 | |||
| 7 | AC_DEFUN([gl_FUNC_READLINK], | ||
| 8 | [ | ||
| 9 | AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) | ||
| 10 | AC_CHECK_FUNCS_ONCE([readlink]) | ||
| 11 | if test $ac_cv_func_readlink = no; then | ||
| 12 | HAVE_READLINK=0 | ||
| 13 | AC_LIBOBJ([readlink]) | ||
| 14 | gl_PREREQ_READLINK | ||
| 15 | else | ||
| 16 | AC_CACHE_CHECK([whether readlink signature is correct], | ||
| 17 | [gl_cv_decl_readlink_works], | ||
| 18 | [AC_COMPILE_IFELSE( | ||
| 19 | [AC_LANG_PROGRAM( | ||
| 20 | [[#include <unistd.h> | ||
| 21 | /* Cause compilation failure if original declaration has wrong type. */ | ||
| 22 | ssize_t readlink (const char *, char *, size_t);]])], | ||
| 23 | [gl_cv_decl_readlink_works=yes], [gl_cv_decl_readlink_works=no])]) | ||
| 24 | dnl Solaris 9 ignores trailing slash. | ||
| 25 | dnl FreeBSD 7.2 dereferences only one level of links with trailing slash. | ||
| 26 | AC_CACHE_CHECK([whether readlink handles trailing slash correctly], | ||
| 27 | [gl_cv_func_readlink_works], | ||
| 28 | [# We have readlink, so assume ln -s works. | ||
| 29 | ln -s conftest.no-such conftest.link | ||
| 30 | ln -s conftest.link conftest.lnk2 | ||
| 31 | AC_RUN_IFELSE( | ||
| 32 | [AC_LANG_PROGRAM( | ||
| 33 | [[#include <unistd.h> | ||
| 34 | ]], [[char buf[20]; | ||
| 35 | return readlink ("conftest.lnk2/", buf, sizeof buf) != -1;]])], | ||
| 36 | [gl_cv_func_readlink_works=yes], [gl_cv_func_readlink_works=no], | ||
| 37 | [gl_cv_func_readlink_works="guessing no"]) | ||
| 38 | rm -f conftest.link conftest.lnk2]) | ||
| 39 | if test "$gl_cv_func_readlink_works" != yes; then | ||
| 40 | AC_DEFINE([READLINK_TRAILING_SLASH_BUG], [1], [Define to 1 if readlink | ||
| 41 | fails to recognize a trailing slash.]) | ||
| 42 | REPLACE_READLINK=1 | ||
| 43 | AC_LIBOBJ([readlink]) | ||
| 44 | elif test "$gl_cv_decl_readlink_works" != yes; then | ||
| 45 | REPLACE_READLINK=1 | ||
| 46 | AC_LIBOBJ([readlink]) | ||
| 47 | fi | ||
| 48 | fi | ||
| 49 | ]) | ||
| 50 | |||
| 51 | # Like gl_FUNC_READLINK, except prepare for separate compilation (no AC_LIBOBJ). | ||
| 52 | AC_DEFUN([gl_FUNC_READLINK_SEPARATE], | ||
| 53 | [ | ||
| 54 | AC_CHECK_FUNCS_ONCE([readlink]) | ||
| 55 | gl_PREREQ_READLINK | ||
| 56 | ]) | ||
| 57 | |||
| 58 | # Prerequisites of lib/readlink.c. | ||
| 59 | AC_DEFUN([gl_PREREQ_READLINK], | ||
| 60 | [ | ||
| 61 | : | ||
| 62 | ]) | ||
diff --git a/m4/stat.m4 b/m4/stat.m4 new file mode 100644 index 00000000000..4883fe25eea --- /dev/null +++ b/m4/stat.m4 | |||
| @@ -0,0 +1,67 @@ | |||
| 1 | # serial 6 | ||
| 2 | |||
| 3 | # Copyright (C) 2009-2011 Free Software Foundation, Inc. | ||
| 4 | # | ||
| 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 | |||
| 9 | AC_DEFUN([gl_FUNC_STAT], | ||
| 10 | [ | ||
| 11 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
| 12 | AC_REQUIRE([gl_AC_DOS]) | ||
| 13 | AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) | ||
| 14 | AC_CHECK_FUNCS_ONCE([lstat]) | ||
| 15 | dnl mingw is the only known platform where stat(".") and stat("./") differ | ||
| 16 | AC_CACHE_CHECK([whether stat handles trailing slashes on directories], | ||
| 17 | [gl_cv_func_stat_dir_slash], | ||
| 18 | [AC_RUN_IFELSE( | ||
| 19 | [AC_LANG_PROGRAM( | ||
| 20 | [[#include <sys/stat.h> | ||
| 21 | ]], [[struct stat st; return stat (".", &st) != stat ("./", &st);]])], | ||
| 22 | [gl_cv_func_stat_dir_slash=yes], [gl_cv_func_stat_dir_slash=no], | ||
| 23 | [case $host_os in | ||
| 24 | mingw*) gl_cv_func_stat_dir_slash="guessing no";; | ||
| 25 | *) gl_cv_func_stat_dir_slash="guessing yes";; | ||
| 26 | esac])]) | ||
| 27 | dnl AIX 7.1, Solaris 9 mistakenly succeed on stat("file/") | ||
| 28 | dnl FreeBSD 7.2 mistakenly succeeds on stat("link-to-file/") | ||
| 29 | AC_CACHE_CHECK([whether stat handles trailing slashes on files], | ||
| 30 | [gl_cv_func_stat_file_slash], | ||
| 31 | [touch conftest.tmp | ||
| 32 | # Assume that if we have lstat, we can also check symlinks. | ||
| 33 | if test $ac_cv_func_lstat = yes; then | ||
| 34 | ln -s conftest.tmp conftest.lnk | ||
| 35 | fi | ||
| 36 | AC_RUN_IFELSE( | ||
| 37 | [AC_LANG_PROGRAM( | ||
| 38 | [[#include <sys/stat.h> | ||
| 39 | ]], [[int result = 0; | ||
| 40 | struct stat st; | ||
| 41 | if (!stat ("conftest.tmp/", &st)) | ||
| 42 | result |= 1; | ||
| 43 | #if HAVE_LSTAT | ||
| 44 | if (!stat ("conftest.lnk/", &st)) | ||
| 45 | result |= 2; | ||
| 46 | #endif | ||
| 47 | return result; | ||
| 48 | ]])], | ||
| 49 | [gl_cv_func_stat_file_slash=yes], [gl_cv_func_stat_file_slash=no], | ||
| 50 | [gl_cv_func_stat_file_slash="guessing no"]) | ||
| 51 | rm -f conftest.tmp conftest.lnk]) | ||
| 52 | case $gl_cv_func_stat_dir_slash in | ||
| 53 | *no) REPLACE_STAT=1 | ||
| 54 | AC_DEFINE([REPLACE_FUNC_STAT_DIR], [1], [Define to 1 if stat needs | ||
| 55 | help when passed a directory name with a trailing slash]);; | ||
| 56 | esac | ||
| 57 | case $gl_cv_func_stat_file_slash in | ||
| 58 | *no) REPLACE_STAT=1 | ||
| 59 | AC_DEFINE([REPLACE_FUNC_STAT_FILE], [1], [Define to 1 if stat needs | ||
| 60 | help when passed a file name with a trailing slash]);; | ||
| 61 | esac | ||
| 62 | if test $REPLACE_STAT = 1; then | ||
| 63 | AC_LIBOBJ([stat]) | ||
| 64 | dnl Prerequisites of lib/stat.c. | ||
| 65 | AC_REQUIRE([AC_C_INLINE]) | ||
| 66 | fi | ||
| 67 | ]) | ||
diff --git a/m4/stdlib_h.m4 b/m4/stdlib_h.m4 index d28b552e905..25fdada0de7 100644 --- a/m4/stdlib_h.m4 +++ b/m4/stdlib_h.m4 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # stdlib_h.m4 serial 36 | 1 | # stdlib_h.m4 serial 37 |
| 2 | dnl Copyright (C) 2007-2011 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2007-2011 Free Software Foundation, Inc. |
| 3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
| @@ -44,6 +44,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS], | |||
| 44 | GNULIB_GETSUBOPT=0; AC_SUBST([GNULIB_GETSUBOPT]) | 44 | GNULIB_GETSUBOPT=0; AC_SUBST([GNULIB_GETSUBOPT]) |
| 45 | GNULIB_GRANTPT=0; AC_SUBST([GNULIB_GRANTPT]) | 45 | GNULIB_GRANTPT=0; AC_SUBST([GNULIB_GRANTPT]) |
| 46 | GNULIB_MALLOC_POSIX=0; AC_SUBST([GNULIB_MALLOC_POSIX]) | 46 | GNULIB_MALLOC_POSIX=0; AC_SUBST([GNULIB_MALLOC_POSIX]) |
| 47 | GNULIB_MBTOWC=0; AC_SUBST([GNULIB_MBTOWC]) | ||
| 47 | GNULIB_MKDTEMP=0; AC_SUBST([GNULIB_MKDTEMP]) | 48 | GNULIB_MKDTEMP=0; AC_SUBST([GNULIB_MKDTEMP]) |
| 48 | GNULIB_MKOSTEMP=0; AC_SUBST([GNULIB_MKOSTEMP]) | 49 | GNULIB_MKOSTEMP=0; AC_SUBST([GNULIB_MKOSTEMP]) |
| 49 | GNULIB_MKOSTEMPS=0; AC_SUBST([GNULIB_MKOSTEMPS]) | 50 | GNULIB_MKOSTEMPS=0; AC_SUBST([GNULIB_MKOSTEMPS]) |
| @@ -62,6 +63,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS], | |||
| 62 | GNULIB_SYSTEM_POSIX=0; AC_SUBST([GNULIB_SYSTEM_POSIX]) | 63 | GNULIB_SYSTEM_POSIX=0; AC_SUBST([GNULIB_SYSTEM_POSIX]) |
| 63 | GNULIB_UNLOCKPT=0; AC_SUBST([GNULIB_UNLOCKPT]) | 64 | GNULIB_UNLOCKPT=0; AC_SUBST([GNULIB_UNLOCKPT]) |
| 64 | GNULIB_UNSETENV=0; AC_SUBST([GNULIB_UNSETENV]) | 65 | GNULIB_UNSETENV=0; AC_SUBST([GNULIB_UNSETENV]) |
| 66 | GNULIB_WCTOMB=0; AC_SUBST([GNULIB_WCTOMB]) | ||
| 65 | dnl Assume proper GNU behavior unless another module says otherwise. | 67 | dnl Assume proper GNU behavior unless another module says otherwise. |
| 66 | HAVE__EXIT=1; AC_SUBST([HAVE__EXIT]) | 68 | HAVE__EXIT=1; AC_SUBST([HAVE__EXIT]) |
| 67 | HAVE_ATOLL=1; AC_SUBST([HAVE_ATOLL]) | 69 | HAVE_ATOLL=1; AC_SUBST([HAVE_ATOLL]) |
| @@ -91,6 +93,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS], | |||
| 91 | REPLACE_CALLOC=0; AC_SUBST([REPLACE_CALLOC]) | 93 | REPLACE_CALLOC=0; AC_SUBST([REPLACE_CALLOC]) |
| 92 | REPLACE_CANONICALIZE_FILE_NAME=0; AC_SUBST([REPLACE_CANONICALIZE_FILE_NAME]) | 94 | REPLACE_CANONICALIZE_FILE_NAME=0; AC_SUBST([REPLACE_CANONICALIZE_FILE_NAME]) |
| 93 | REPLACE_MALLOC=0; AC_SUBST([REPLACE_MALLOC]) | 95 | REPLACE_MALLOC=0; AC_SUBST([REPLACE_MALLOC]) |
| 96 | REPLACE_MBTOWC=0; AC_SUBST([REPLACE_MBTOWC]) | ||
| 94 | REPLACE_MKSTEMP=0; AC_SUBST([REPLACE_MKSTEMP]) | 97 | REPLACE_MKSTEMP=0; AC_SUBST([REPLACE_MKSTEMP]) |
| 95 | REPLACE_PUTENV=0; AC_SUBST([REPLACE_PUTENV]) | 98 | REPLACE_PUTENV=0; AC_SUBST([REPLACE_PUTENV]) |
| 96 | REPLACE_REALLOC=0; AC_SUBST([REPLACE_REALLOC]) | 99 | REPLACE_REALLOC=0; AC_SUBST([REPLACE_REALLOC]) |
| @@ -98,4 +101,5 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS], | |||
| 98 | REPLACE_SETENV=0; AC_SUBST([REPLACE_SETENV]) | 101 | REPLACE_SETENV=0; AC_SUBST([REPLACE_SETENV]) |
| 99 | REPLACE_STRTOD=0; AC_SUBST([REPLACE_STRTOD]) | 102 | REPLACE_STRTOD=0; AC_SUBST([REPLACE_STRTOD]) |
| 100 | REPLACE_UNSETENV=0; AC_SUBST([REPLACE_UNSETENV]) | 103 | REPLACE_UNSETENV=0; AC_SUBST([REPLACE_UNSETENV]) |
| 104 | REPLACE_WCTOMB=0; AC_SUBST([REPLACE_WCTOMB]) | ||
| 101 | ]) | 105 | ]) |
diff --git a/m4/symlink.m4 b/m4/symlink.m4 new file mode 100644 index 00000000000..917d5f0ec2c --- /dev/null +++ b/m4/symlink.m4 | |||
| @@ -0,0 +1,45 @@ | |||
| 1 | # serial 4 | ||
| 2 | # See if we need to provide symlink replacement. | ||
| 3 | |||
| 4 | dnl Copyright (C) 2009-2011 Free Software Foundation, Inc. | ||
| 5 | dnl This file is free software; the Free Software Foundation | ||
| 6 | dnl gives unlimited permission to copy and/or distribute it, | ||
| 7 | dnl with or without modifications, as long as this notice is preserved. | ||
| 8 | |||
| 9 | # Written by Eric Blake. | ||
| 10 | |||
| 11 | AC_DEFUN([gl_FUNC_SYMLINK], | ||
| 12 | [ | ||
| 13 | AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) | ||
| 14 | AC_CHECK_FUNCS_ONCE([symlink]) | ||
| 15 | dnl The best we can do on mingw is provide a dummy that always fails, so | ||
| 16 | dnl that compilation can proceed with fewer ifdefs. On FreeBSD 7.2, AIX 7.1, | ||
| 17 | dnl and Solaris 9, we want to fix a bug with trailing slash handling. | ||
| 18 | if test $ac_cv_func_symlink = no; then | ||
| 19 | HAVE_SYMLINK=0 | ||
| 20 | AC_LIBOBJ([symlink]) | ||
| 21 | else | ||
| 22 | AC_CACHE_CHECK([whether symlink handles trailing slash correctly], | ||
| 23 | [gl_cv_func_symlink_works], | ||
| 24 | [AC_RUN_IFELSE( | ||
| 25 | [AC_LANG_PROGRAM( | ||
| 26 | [[#include <unistd.h> | ||
| 27 | ]], | ||
| 28 | [[int result = 0; | ||
| 29 | if (!symlink ("a", "conftest.link/")) | ||
| 30 | result |= 1; | ||
| 31 | if (symlink ("conftest.f", "conftest.lnk2")) | ||
| 32 | result |= 2; | ||
| 33 | else if (!symlink ("a", "conftest.lnk2/")) | ||
| 34 | result |= 4; | ||
| 35 | return result; | ||
| 36 | ]])], | ||
| 37 | [gl_cv_func_symlink_works=yes], [gl_cv_func_symlink_works=no], | ||
| 38 | [gl_cv_func_symlink_works="guessing no"]) | ||
| 39 | rm -f conftest.f conftest.link conftest.lnk2]) | ||
| 40 | if test "$gl_cv_func_symlink_works" != yes; then | ||
| 41 | REPLACE_SYMLINK=1 | ||
| 42 | AC_LIBOBJ([symlink]) | ||
| 43 | fi | ||
| 44 | fi | ||
| 45 | ]) | ||
diff --git a/src/ChangeLog b/src/ChangeLog index 8befb78f91f..6673a25f74f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,12 @@ | |||
| 1 | 2011-02-22 Paul Eggert <eggert@cs.ucla.edu> | 1 | 2011-02-22 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 2 | ||
| 3 | Work around some portability problems with symlinks. | ||
| 4 | * fileio.c (Frename_file, Fmake_symbolic_link, Ffile_symlink_p): | ||
| 5 | Simplify the code by assuming that the readlink and symlink calls | ||
| 6 | exist, even if they always fail on this host. | ||
| 7 | (Ffile_readable_p): Likewise, for fifos. | ||
| 8 | * config.in: Regenerate. | ||
| 9 | |||
| 3 | * dired.c (Ffile_attributes): Simplify and avoid #ifdef. | 10 | * dired.c (Ffile_attributes): Simplify and avoid #ifdef. |
| 4 | 11 | ||
| 5 | 2011-02-22 Wolfgang Jenkner <wjenkner@inode.at> (tiny change) | 12 | 2011-02-22 Wolfgang Jenkner <wjenkner@inode.at> (tiny change) |
diff --git a/src/config.in b/src/config.in index ded8c6b292a..2a2a71659f5 100644 --- a/src/config.in +++ b/src/config.in | |||
| @@ -72,6 +72,19 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 72 | /* Enable expensive run-time checking of data types? */ | 72 | /* Enable expensive run-time checking of data types? */ |
| 73 | #undef ENABLE_CHECKING | 73 | #undef ENABLE_CHECKING |
| 74 | 74 | ||
| 75 | /* Define on systems for which file names may have a so-called `drive letter' | ||
| 76 | prefix, define this to compute the length of that prefix, including the | ||
| 77 | colon. */ | ||
| 78 | #undef FILE_SYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX | ||
| 79 | |||
| 80 | /* Define if the backslash character may also serve as a file name component | ||
| 81 | separator. */ | ||
| 82 | #undef FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR | ||
| 83 | |||
| 84 | /* Define if a drive letter prefix denotes a relative path if it is not | ||
| 85 | followed by a file name component separator. */ | ||
| 86 | #undef FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE | ||
| 87 | |||
| 75 | /* Define this to check for errors in cons list. */ | 88 | /* Define this to check for errors in cons list. */ |
| 76 | #undef GC_CHECK_CONS_LIST | 89 | #undef GC_CHECK_CONS_LIST |
| 77 | 90 | ||
| @@ -576,6 +589,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 576 | /* Define to 1 if you have the `random' function. */ | 589 | /* Define to 1 if you have the `random' function. */ |
| 577 | #undef HAVE_RANDOM | 590 | #undef HAVE_RANDOM |
| 578 | 591 | ||
| 592 | /* Define to 1 if you have the `readlink' function. */ | ||
| 593 | #undef HAVE_READLINK | ||
| 594 | |||
| 579 | /* Define to 1 if you have the `recvfrom' function. */ | 595 | /* Define to 1 if you have the `recvfrom' function. */ |
| 580 | #undef HAVE_RECVFROM | 596 | #undef HAVE_RECVFROM |
| 581 | 597 | ||
| @@ -696,6 +712,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 696 | /* Define if struct stat has an st_dm_mode member. */ | 712 | /* Define if struct stat has an st_dm_mode member. */ |
| 697 | #undef HAVE_ST_DM_MODE | 713 | #undef HAVE_ST_DM_MODE |
| 698 | 714 | ||
| 715 | /* Define to 1 if you have the `symlink' function. */ | ||
| 716 | #undef HAVE_SYMLINK | ||
| 717 | |||
| 699 | /* Define to 1 if you have the `sync' function. */ | 718 | /* Define to 1 if you have the `sync' function. */ |
| 700 | #undef HAVE_SYNC | 719 | #undef HAVE_SYNC |
| 701 | 720 | ||
| @@ -888,6 +907,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 888 | /* Define to support using a Hesiod database to find the POP server. */ | 907 | /* Define to support using a Hesiod database to find the POP server. */ |
| 889 | #undef HESIOD | 908 | #undef HESIOD |
| 890 | 909 | ||
| 910 | #if FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR | ||
| 911 | # define ISSLASH(C) ((C) == '/' || (C) == '\\') | ||
| 912 | #else | ||
| 913 | # define ISSLASH(C) ((C) == '/') | ||
| 914 | #endif | ||
| 915 | |||
| 891 | /* Define to support Kerberos-authenticated POP mail retrieval. */ | 916 | /* Define to support Kerberos-authenticated POP mail retrieval. */ |
| 892 | #undef KERBEROS | 917 | #undef KERBEROS |
| 893 | 918 | ||
| @@ -897,6 +922,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 897 | /* Define to 1 if localtime caches TZ. */ | 922 | /* Define to 1 if localtime caches TZ. */ |
| 898 | #undef LOCALTIME_CACHE | 923 | #undef LOCALTIME_CACHE |
| 899 | 924 | ||
| 925 | /* Define to 1 if `lstat' dereferences a symlink specified with a trailing | ||
| 926 | slash. */ | ||
| 927 | #undef LSTAT_FOLLOWS_SLASHED_SYMLINK | ||
| 928 | |||
| 900 | /* String giving fallback POP mail host. */ | 929 | /* String giving fallback POP mail host. */ |
| 901 | #undef MAILHOST | 930 | #undef MAILHOST |
| 902 | 931 | ||
| @@ -968,10 +997,21 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 968 | 'ptrdiff_t'. */ | 997 | 'ptrdiff_t'. */ |
| 969 | #undef PTRDIFF_T_SUFFIX | 998 | #undef PTRDIFF_T_SUFFIX |
| 970 | 999 | ||
| 1000 | /* Define to 1 if readlink fails to recognize a trailing slash. */ | ||
| 1001 | #undef READLINK_TRAILING_SLASH_BUG | ||
| 1002 | |||
| 971 | /* Define REL_ALLOC if you want to use the relocating allocator for buffer | 1003 | /* Define REL_ALLOC if you want to use the relocating allocator for buffer |
| 972 | space. */ | 1004 | space. */ |
| 973 | #undef REL_ALLOC | 1005 | #undef REL_ALLOC |
| 974 | 1006 | ||
| 1007 | /* Define to 1 if stat needs help when passed a directory name with a trailing | ||
| 1008 | slash */ | ||
| 1009 | #undef REPLACE_FUNC_STAT_DIR | ||
| 1010 | |||
| 1011 | /* Define to 1 if stat needs help when passed a file name with a trailing | ||
| 1012 | slash */ | ||
| 1013 | #undef REPLACE_FUNC_STAT_FILE | ||
| 1014 | |||
| 975 | /* Define as the return type of signal handlers (`int' or `void'). */ | 1015 | /* Define as the return type of signal handlers (`int' or `void'). */ |
| 976 | #undef RETSIGTYPE | 1016 | #undef RETSIGTYPE |
| 977 | 1017 | ||
diff --git a/src/fileio.c b/src/fileio.c index 0225e0bf3a9..26006d63052 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -2178,14 +2178,11 @@ This is what happens in interactive use with M-x. */) | |||
| 2178 | if (errno == EXDEV) | 2178 | if (errno == EXDEV) |
| 2179 | { | 2179 | { |
| 2180 | int count; | 2180 | int count; |
| 2181 | #ifdef S_IFLNK | ||
| 2182 | symlink_target = Ffile_symlink_p (file); | 2181 | symlink_target = Ffile_symlink_p (file); |
| 2183 | if (! NILP (symlink_target)) | 2182 | if (! NILP (symlink_target)) |
| 2184 | Fmake_symbolic_link (symlink_target, newname, | 2183 | Fmake_symbolic_link (symlink_target, newname, |
| 2185 | NILP (ok_if_already_exists) ? Qnil : Qt); | 2184 | NILP (ok_if_already_exists) ? Qnil : Qt); |
| 2186 | else | 2185 | else if (!NILP (Ffile_directory_p (file))) |
| 2187 | #endif | ||
| 2188 | if (!NILP (Ffile_directory_p (file))) | ||
| 2189 | call4 (Qcopy_directory, file, newname, Qt, Qnil); | 2186 | call4 (Qcopy_directory, file, newname, Qt, Qnil); |
| 2190 | else | 2187 | else |
| 2191 | /* We have already prompted if it was an integer, so don't | 2188 | /* We have already prompted if it was an integer, so don't |
| @@ -2197,11 +2194,7 @@ This is what happens in interactive use with M-x. */) | |||
| 2197 | count = SPECPDL_INDEX (); | 2194 | count = SPECPDL_INDEX (); |
| 2198 | specbind (Qdelete_by_moving_to_trash, Qnil); | 2195 | specbind (Qdelete_by_moving_to_trash, Qnil); |
| 2199 | 2196 | ||
| 2200 | if (!NILP (Ffile_directory_p (file)) | 2197 | if (!NILP (Ffile_directory_p (file)) && NILP (symlink_target)) |
| 2201 | #ifdef S_IFLNK | ||
| 2202 | && NILP (symlink_target) | ||
| 2203 | #endif | ||
| 2204 | ) | ||
| 2205 | call2 (Qdelete_directory, file, Qt); | 2198 | call2 (Qdelete_directory, file, Qt); |
| 2206 | else | 2199 | else |
| 2207 | Fdelete_file (file, Qnil); | 2200 | Fdelete_file (file, Qnil); |
| @@ -2311,7 +2304,6 @@ This happens for interactive use with M-x. */) | |||
| 2311 | RETURN_UNGCPRO (call4 (handler, Qmake_symbolic_link, filename, | 2304 | RETURN_UNGCPRO (call4 (handler, Qmake_symbolic_link, filename, |
| 2312 | linkname, ok_if_already_exists)); | 2305 | linkname, ok_if_already_exists)); |
| 2313 | 2306 | ||
| 2314 | #ifdef S_IFLNK | ||
| 2315 | encoded_filename = ENCODE_FILE (filename); | 2307 | encoded_filename = ENCODE_FILE (filename); |
| 2316 | encoded_linkname = ENCODE_FILE (linkname); | 2308 | encoded_linkname = ENCODE_FILE (linkname); |
| 2317 | 2309 | ||
| @@ -2338,12 +2330,6 @@ This happens for interactive use with M-x. */) | |||
| 2338 | } | 2330 | } |
| 2339 | UNGCPRO; | 2331 | UNGCPRO; |
| 2340 | return Qnil; | 2332 | return Qnil; |
| 2341 | |||
| 2342 | #else | ||
| 2343 | UNGCPRO; | ||
| 2344 | xsignal1 (Qfile_error, build_string ("Symbolic links are not supported")); | ||
| 2345 | |||
| 2346 | #endif /* S_IFLNK */ | ||
| 2347 | } | 2333 | } |
| 2348 | 2334 | ||
| 2349 | 2335 | ||
| @@ -2482,7 +2468,7 @@ See also `file-exists-p' and `file-attributes'. */) | |||
| 2482 | return Qnil; | 2468 | return Qnil; |
| 2483 | #else /* not DOS_NT and not macintosh */ | 2469 | #else /* not DOS_NT and not macintosh */ |
| 2484 | flags = O_RDONLY; | 2470 | flags = O_RDONLY; |
| 2485 | #if defined (S_IFIFO) && defined (O_NONBLOCK) | 2471 | #ifdef O_NONBLOCK |
| 2486 | /* Opening a fifo without O_NONBLOCK can wait. | 2472 | /* Opening a fifo without O_NONBLOCK can wait. |
| 2487 | We don't want to wait. But we don't want to mess wth O_NONBLOCK | 2473 | We don't want to wait. But we don't want to mess wth O_NONBLOCK |
| 2488 | except in the case of a fifo, on a system which handles it. */ | 2474 | except in the case of a fifo, on a system which handles it. */ |
| @@ -2584,6 +2570,10 @@ points to a nonexistent file. */) | |||
| 2584 | (Lisp_Object filename) | 2570 | (Lisp_Object filename) |
| 2585 | { | 2571 | { |
| 2586 | Lisp_Object handler; | 2572 | Lisp_Object handler; |
| 2573 | char *buf; | ||
| 2574 | int bufsize; | ||
| 2575 | int valsize; | ||
| 2576 | Lisp_Object val; | ||
| 2587 | 2577 | ||
| 2588 | CHECK_STRING (filename); | 2578 | CHECK_STRING (filename); |
| 2589 | filename = Fexpand_file_name (filename, Qnil); | 2579 | filename = Fexpand_file_name (filename, Qnil); |
| @@ -2594,13 +2584,6 @@ points to a nonexistent file. */) | |||
| 2594 | if (!NILP (handler)) | 2584 | if (!NILP (handler)) |
| 2595 | return call2 (handler, Qfile_symlink_p, filename); | 2585 | return call2 (handler, Qfile_symlink_p, filename); |
| 2596 | 2586 | ||
| 2597 | #ifdef S_IFLNK | ||
| 2598 | { | ||
| 2599 | char *buf; | ||
| 2600 | int bufsize; | ||
| 2601 | int valsize; | ||
| 2602 | Lisp_Object val; | ||
| 2603 | |||
| 2604 | filename = ENCODE_FILE (filename); | 2587 | filename = ENCODE_FILE (filename); |
| 2605 | 2588 | ||
| 2606 | bufsize = 50; | 2589 | bufsize = 50; |
| @@ -2635,10 +2618,6 @@ points to a nonexistent file. */) | |||
| 2635 | xfree (buf); | 2618 | xfree (buf); |
| 2636 | val = DECODE_FILE (val); | 2619 | val = DECODE_FILE (val); |
| 2637 | return val; | 2620 | return val; |
| 2638 | } | ||
| 2639 | #else /* not S_IFLNK */ | ||
| 2640 | return Qnil; | ||
| 2641 | #endif /* not S_IFLNK */ | ||
| 2642 | } | 2621 | } |
| 2643 | 2622 | ||
| 2644 | DEFUN ("file-directory-p", Ffile_directory_p, Sfile_directory_p, 1, 1, 0, | 2623 | DEFUN ("file-directory-p", Ffile_directory_p, Sfile_directory_p, 1, 1, 0, |