mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-08-11 15:01:16 +02:00
33212: try to put /usr/local/share/zsh/site-functions in default fpath
This commit is contained in:
parent
f4aae44162
commit
0c7a3d6864
4 changed files with 44 additions and 12 deletions
|
@ -1,5 +1,10 @@
|
|||
2014-09-20 Peter Stephenson <p.w.stephenson@ntlworld.com>
|
||||
|
||||
* 33212: Src/zsh.mdd: Src/init.c, Src/zsh.mdd, configure.ac: add
|
||||
/usr/local/share/zsh/site-functions to head of fpath if not
|
||||
present in configurable. Not configurable as serves as fallback
|
||||
only if no handling /etc/zshenv.
|
||||
|
||||
* Tanu Kaskinen: 33209: Doc/Makefile.in: don't fail
|
||||
catastrophically when builing zsh.texi if yodl isn't available.
|
||||
|
||||
|
|
35
Src/init.c
35
Src/init.c
|
@ -770,7 +770,8 @@ setupvals(void)
|
|||
struct timezone dummy_tz;
|
||||
char *ptr;
|
||||
int i, j;
|
||||
#if defined(SITEFPATH_DIR) || defined(FPATH_DIR) || defined (ADDITIONAL_FPATH)
|
||||
#if defined(SITEFPATH_DIR) || defined(FPATH_DIR) || defined (ADDITIONAL_FPATH) || defined(FIXED_FPATH_DIR)
|
||||
#define FPATH_NEEDS_INIT 1
|
||||
char **fpathptr;
|
||||
# if defined(FPATH_DIR) && defined(FPATH_SUBDIRS)
|
||||
char *fpath_subdirs[] = FPATH_SUBDIRS;
|
||||
|
@ -779,11 +780,17 @@ setupvals(void)
|
|||
char *more_fndirs[] = ADDITIONAL_FPATH;
|
||||
int more_fndirs_len;
|
||||
# endif
|
||||
# ifdef SITEFPATH_DIR
|
||||
int fpathlen = 1;
|
||||
# ifdef FIXED_FPATH_DIR
|
||||
# define FIXED_FPATH_LEN 1
|
||||
# else
|
||||
int fpathlen = 0;
|
||||
# define FIXED_FPATH_LEN 0
|
||||
# endif
|
||||
# ifdef SITEFPATH_DIR
|
||||
# define SITE_FPATH_LEN 1
|
||||
# else
|
||||
# define SITE_FPATH_LEN 0
|
||||
# endif
|
||||
int fpathlen = FIXED_FPATH_LEN + SITE_FPATH_LEN;
|
||||
#endif
|
||||
int close_fds[10], tmppipe[2];
|
||||
|
||||
|
@ -862,23 +869,27 @@ setupvals(void)
|
|||
manpath = mkarray(NULL);
|
||||
fignore = mkarray(NULL);
|
||||
|
||||
#if defined(SITEFPATH_DIR) || defined(FPATH_DIR) || defined(ADDITIONAL_FPATH)
|
||||
#ifdef FPATH_NEEDS_INIT
|
||||
# ifdef FPATH_DIR
|
||||
# ifdef FPATH_SUBDIRS
|
||||
fpathlen += sizeof(fpath_subdirs)/sizeof(char *);
|
||||
# else
|
||||
# else /* FPATH_SUBDIRS */
|
||||
fpathlen++;
|
||||
# endif
|
||||
# endif
|
||||
# endif /* FPATH_SUBDIRS */
|
||||
# endif /* FPATH_DIR */
|
||||
# if defined(ADDITIONAL_FPATH)
|
||||
more_fndirs_len = sizeof(more_fndirs)/sizeof(char *);
|
||||
fpathlen += more_fndirs_len;
|
||||
# endif
|
||||
# endif /* ADDITONAL_FPATH */
|
||||
fpath = fpathptr = (char **)zalloc((fpathlen+1)*sizeof(char *));
|
||||
# ifdef FIXED_FPATH_DIR
|
||||
*fpathptr++ = ztrdup(FIXED_FPATH_DIR);
|
||||
fpathlen--;
|
||||
# endif
|
||||
# ifdef SITEFPATH_DIR
|
||||
*fpathptr++ = ztrdup(SITEFPATH_DIR);
|
||||
fpathlen--;
|
||||
# endif
|
||||
# endif /* SITEFPATH_DIR */
|
||||
# if defined(ADDITIONAL_FPATH)
|
||||
for (j = 0; j < more_fndirs_len; j++)
|
||||
*fpathptr++ = ztrdup(more_fndirs[j]);
|
||||
|
@ -897,9 +908,9 @@ setupvals(void)
|
|||
# endif
|
||||
# endif
|
||||
*fpathptr = NULL;
|
||||
#else
|
||||
#else /* FPATH_NEEDS_INIT */
|
||||
fpath = mkarray(NULL);
|
||||
#endif
|
||||
#endif /* FPATH_NEEDS_INIT */
|
||||
|
||||
mailpath = mkarray(NULL);
|
||||
watch = mkarray(NULL);
|
||||
|
|
|
@ -73,6 +73,9 @@ zshpaths.h: Makemod $(CONFIG_INCS)
|
|||
@if test x$(sitefndir) != xno; then \
|
||||
echo '#define SITEFPATH_DIR "'$(sitefndir)'"' >> zshpaths.h.tmp; \
|
||||
fi
|
||||
@if test x$(fixed_sitefndir) != x; then \
|
||||
echo '#define FIXED_FPATH_DIR "'$(fixed_sitefndir)'"' >> zshpaths.h.tmp; \
|
||||
fi
|
||||
@if test x$(fndir) != xno; then \
|
||||
echo '#define FPATH_DIR "'$(fndir)'"' >> zshpaths.h.tmp; \
|
||||
if test x$(FUNCTIONS_SUBDIRS) != x && \
|
||||
|
|
13
configure.ac
13
configure.ac
|
@ -315,6 +315,18 @@ else
|
|||
sitefndir="$enableval"
|
||||
fi], [sitefndir=${datadir}/${tzsh_name}/site-functions])
|
||||
|
||||
dnl Add /usr/local/share/zsh/site-functions if not yet present.
|
||||
dnl It might be present owing to an explicit sitefndir or the install
|
||||
dnl prefix if the shell is installed under the name "zsh".
|
||||
if test X$sitefndir = X/usr/local/zsh/site-functions
|
||||
then fixed_sitefndir=''
|
||||
elif test X$ac_default_prefix != X/usr/local
|
||||
then fixed_sitefndir=/usr/local/zsh/site-functions
|
||||
elif test X$tzsh_name != Xzsh
|
||||
then fixed_sitefndir=/usr/local/zsh/site-functions
|
||||
else fixed_sitefndir=''
|
||||
fi
|
||||
|
||||
ifdef([function_subdirs],[undefine([function_subdirs])])
|
||||
AC_ARG_ENABLE(function-subdirs,
|
||||
AC_HELP_STRING([--enable-function-subdirs], [install functions in subdirectories]))
|
||||
|
@ -340,6 +352,7 @@ AC_SUBST(runhelp)dnl
|
|||
AC_SUBST(additionalfpath)dnl
|
||||
AC_SUBST(fndir)dnl
|
||||
AC_SUBST(sitefndir)dnl
|
||||
AC_SUBST(fixed_sitefndir)dnl
|
||||
AC_SUBST(FUNCTIONS_SUBDIRS)dnl
|
||||
|
||||
dnl Directories for scripts such as newuser.
|
||||
|
|
Loading…
Reference in a new issue