]> granicus.if.org Git - curl/commitdiff
build: Install zsh completion
authorDaniel Shahaf <d.s@daniel.shahaf.name>
Fri, 20 Nov 2015 04:56:10 +0000 (04:56 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 24 Nov 2015 21:22:01 +0000 (22:22 +0100)
Fixes #534
Closes #537

.gitignore
Makefile.am
configure.ac
scripts/Makefile.am [new file with mode: 0644]

index a2e7df8b890c7a41b909a07d9b701bb9658c1760..183136a6871befa3558d13ae5cb92d190637ad03 100644 (file)
@@ -49,3 +49,4 @@ missing
 mkinstalldirs
 tags
 test-driver
+scripts/_curl
index bdcf4b5f3caacddab2187ab71d1a98bdecdda07f..39749888922da00a32e22f8118c3dca5941406c4 100644 (file)
@@ -140,7 +140,7 @@ CLEANFILES = $(VC6_LIBDSP) $(VC6_SRCDSP) $(VC7_LIBVCPROJ) $(VC7_SRCVCPROJ)  \
 
 bin_SCRIPTS = curl-config
 
-SUBDIRS = lib src include
+SUBDIRS = lib src include scripts
 DIST_SUBDIRS = $(SUBDIRS) tests packages docs
 
 pkgconfigdir = $(libdir)/pkgconfig
index e51be4f93dfd2fa8696f49392ece5d841bfd196a..4c14e382ea69199c1f1f7aa28febf76654c3cb95 100644 (file)
@@ -3030,6 +3030,31 @@ if test X"$want_h2" != Xno; then
 
 fi
 
+dnl **********************************************************************
+dnl Check for zsh completion path
+dnl **********************************************************************
+
+OPT_ZSH_FPATH=default
+AC_ARG_WITH(zsh-functions-dir,
+AC_HELP_STRING([--with-zsh-functions-dir=PATH],[Install zsh completions to PATH])
+AC_HELP_STRING([--without-zsh-functions-dir],[Do not install zsh completions]),
+  [OPT_ZSH_FPATH=$withval])
+case "$OPT_ZSH_FPATH" in
+  no)
+    dnl --without-zsh-functions-dir option used
+    ;;
+  default|yes)
+    dnl --with-zsh-functions-dir option used without path
+    ZSH_FUNCTIONS_DIR="$datarootdir/zsh/site-functions"
+    AC_SUBST(ZSH_FUNCTIONS_DIR)
+    ;;
+  *)
+    dnl --with-zsh-functions-dir option used with path
+    ZSH_FUNCTIONS_DIR="$withval"
+    AC_SUBST(ZSH_FUNCTIONS_DIR)
+    ;;
+esac
+
 dnl **********************************************************************
 dnl Back to "normal" configuring
 dnl **********************************************************************
@@ -3797,6 +3822,7 @@ AC_CONFIG_FILES([Makefile \
            include/curl/Makefile \
            src/Makefile \
            lib/Makefile \
+           scripts/Makefile \
            lib/libcurl.vers \
            tests/Makefile \
            tests/certs/Makefile \
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
new file mode 100644 (file)
index 0000000..6978d41
--- /dev/null
@@ -0,0 +1,13 @@
+ZSH_FUNCTIONS_DIR = @ZSH_FUNCTIONS_DIR@
+PERL = @PERL@
+
+ZSH_COMPLETION_FUNCTION_FILENAME = _curl
+
+all-local: $(ZSH_COMPLETION_FUNCTION_FILENAME)
+
+$(ZSH_COMPLETION_FUNCTION_FILENAME): zsh.pl
+       $(PERL) $< > $@
+
+install-data-local:
+       $(MKDIR_P) $(ZSH_FUNCTIONS_DIR)
+       $(INSTALL_DATA) $(ZSH_COMPLETION_FUNCTION_FILENAME) $(ZSH_FUNCTIONS_DIR)/$(ZSH_COMPLETION_FUNCTION_FILENAME)