From: Viktor Szakats Date: Fri, 1 Aug 2025 22:18:12 +0000 (+0200) Subject: configure: if no perl, disable unity and shell completion, related tidy ups X-Git-Tag: curl-8_16_0~272 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1644a49ab8d077980950a7ea15287b26bf596638;p=thirdparty%2Fcurl.git configure: if no perl, disable unity and shell completion, related tidy ups Also: - GHA/linux, macos: test `install` with autotools too. - GHA/linux, macos: enable fish and zsh completion in an autotools job. - scripts: drop dynamic perl checks redundant after this patch. - scripts: drop two interim variables. - autotools: make `build-certs` target check perl first. - autotools: replace `$(PERL)` with `@PERL@` to match the pattern used in most automake scripts. For consistency. This makes `PERL` be defined at configure-time, as opposed to make-time, for these cases now. Closes #18141 --- diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index cea06e814d..be0468ff8d 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -108,7 +108,7 @@ jobs: - name: 'mbedtls clang' install_packages: libnghttp2-dev libldap-dev clang install_steps: mbedtls pytest - configure: CC=clang LDFLAGS=-Wl,-rpath,/home/runner/mbedtls/lib --with-mbedtls=/home/runner/mbedtls --enable-debug + configure: CC=clang LDFLAGS=-Wl,-rpath,/home/runner/mbedtls/lib --with-mbedtls=/home/runner/mbedtls --enable-debug --with-fish-functions-dir --with-zsh-functions-dir - name: 'mbedtls' install_packages: libnghttp2-dev @@ -572,7 +572,7 @@ jobs: else mkdir bld && cd bld && \ ${MATRIX_CONFIGURE_PREFIX} \ - ../configure --enable-unity --enable-warnings --enable-werror \ + ../configure --prefix="$HOME"/curl-install --enable-unity --enable-warnings --enable-werror \ --disable-dependency-tracking \ ${MATRIX_CONFIGURE} fi @@ -614,9 +614,13 @@ jobs: if: ${{ matrix.build.make-custom-target != 'tidy' }} run: bld/src/curl -V - - name: 'cmake install' - if: ${{ matrix.build.generate }} - run: cmake --install bld --strip + - name: 'curl install' + run: | + if [ "${MATRIX_BUILD}" = 'cmake' ]; then + cmake --install bld --strip + else + make -C bld V=1 install + fi - name: 'build tests' if: ${{ !contains(matrix.build.install_steps, 'skipall') }} diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index b35c9a08c4..cdb6de2834 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -238,7 +238,7 @@ jobs: - name: 'OpenSSL libssh c-ares' compiler: clang install: libssh - configure: --enable-debug --with-libssh --with-openssl=/opt/homebrew/opt/openssl --enable-ares + configure: --enable-debug --with-libssh --with-openssl=/opt/homebrew/opt/openssl --enable-ares --with-fish-functions-dir --with-zsh-functions-dir - name: 'OpenSSL libssh' compiler: llvm@18 install: libssh libnghttp3 @@ -423,7 +423,7 @@ jobs: fi [ -n "${MATRIX_MACOS_VERSION_MIN}" ] && CFLAGS+=" -mmacosx-version-min=${MATRIX_MACOS_VERSION_MIN}" [[ "${MATRIX_INSTALL_STEPS}" = *'pytest'* ]] && options+=' --with-test-vsftpd=no' # Skip ~20 tests that stretch run time by 7x on macOS - mkdir bld && cd bld && ../configure --enable-unity --enable-warnings --enable-werror \ + mkdir bld && cd bld && ../configure --prefix="$PWD"/curl-install --enable-unity --enable-warnings --enable-werror \ --disable-dependency-tracking \ --with-libpsl=/opt/homebrew/opt/libpsl \ ${MATRIX_CONFIGURE} ${options} @@ -452,9 +452,13 @@ jobs: - name: 'curl version' run: bld/src/curl --disable --version - - name: 'cmake install' - if: ${{ matrix.build.generate }} - run: cmake --install bld --strip + - name: 'curl install' + run: | + if [ "${MATRIX_BUILD}" = 'cmake' ]; then + cmake --install bld --strip + else + make -C bld V=1 install + fi - name: 'build tests' run: | diff --git a/Makefile.am b/Makefile.am index 515fa3c8b4..08af6cd028 100644 --- a/Makefile.am +++ b/Makefile.am @@ -172,7 +172,7 @@ rpms: $(MAKE) RPMDIST=curl-ssl rpm rpm: - RPM_TOPDIR=`rpm --showrc | $(PERL) -n -e 'print if(s/.*_topdir\s+(.*)/$$1/)'` ; \ + RPM_TOPDIR=`rpm --showrc | @PERL@ -n -e 'print if(s/.*_topdir\s+(.*)/$$1/)'` ; \ cp $(srcdir)/packages/Linux/RPM/$(RPMDIST).spec $$RPM_TOPDIR/SPECS ; \ cp $(PACKAGE)-$(VERSION).tar.gz $$RPM_TOPDIR/SOURCES ; \ rpm -ba --clean --rmsource $$RPM_TOPDIR/SPECS/$(RPMDIST).spec ; \ diff --git a/configure.ac b/configure.ac index a76761d797..5348261033 100644 --- a/configure.ac +++ b/configure.ac @@ -663,7 +663,10 @@ AS_HELP_STRING([--disable-unity],[Disable unity (default)]), esac ], AC_MSG_RESULT([no]) ) - +if test -z "$PERL" -a "$want_unity" = 'yes'; then + AC_MSG_WARN([perl was not found. Will not enable unity.]) + want_unity='no' +fi AM_CONDITIONAL([USE_UNITY], [test "$want_unity" = 'yes']) dnl ************************************************************ @@ -3901,6 +3904,10 @@ case "$OPT_ZSH_FPATH" in AC_SUBST(ZSH_FUNCTIONS_DIR) ;; esac +if test -z "$PERL" -a x"$ZSH_FUNCTIONS_DIR" != x; then + AC_MSG_WARN([perl was not found. Will not install zsh completions.]) + ZSH_FUNCTIONS_DIR='' +fi AM_CONDITIONAL(USE_ZSH_COMPLETION, test x"$ZSH_FUNCTIONS_DIR" != x) dnl ********************************************************************** @@ -3932,6 +3939,10 @@ case "$OPT_FISH_FPATH" in AC_SUBST(FISH_FUNCTIONS_DIR) ;; esac +if test -z "$PERL" -a x"$FISH_FUNCTIONS_DIR" != x; then + AC_MSG_WARN([perl was not found. Will not install fish completions.]) + FISH_FUNCTIONS_DIR='' +fi AM_CONDITIONAL(USE_FISH_COMPLETION, test x"$FISH_FUNCTIONS_DIR" != x) dnl Now check for the very most basic headers. Then we can use these diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 2c98aac9f7..cfa3d3e740 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -29,10 +29,6 @@ EXTRA_DIST = coverage.sh completion.pl firefox-db2pem.sh checksrc.pl checksrc-al dist_bin_SCRIPTS = wcurl -ZSH_FUNCTIONS_DIR = @ZSH_FUNCTIONS_DIR@ -FISH_FUNCTIONS_DIR = @FISH_FUNCTIONS_DIR@ -PERL = @PERL@ - if USE_ZSH_COMPLETION ZSH_COMPLETION_FUNCTION_FILENAME = _curl endif @@ -46,28 +42,22 @@ all-local: $(ZSH_COMPLETION_FUNCTION_FILENAME) $(FISH_COMPLETION_FUNCTION_FILENA if USE_ZSH_COMPLETION $(ZSH_COMPLETION_FUNCTION_FILENAME): completion.pl - if test -z "$(PERL)"; then echo 'No perl: cannot generate completion script'; else \ - $(PERL) $(srcdir)/completion.pl --opts-dir $(top_srcdir)/docs/cmdline-opts --shell zsh > $@; fi + @PERL@ $(srcdir)/completion.pl --opts-dir $(top_srcdir)/docs/cmdline-opts --shell zsh > $@ endif if USE_FISH_COMPLETION $(FISH_COMPLETION_FUNCTION_FILENAME): completion.pl - if test -z "$(PERL)"; then echo 'No perl: cannot generate completion script'; else \ - $(PERL) $(srcdir)/completion.pl --opts-dir $(top_srcdir)/docs/cmdline-opts --shell fish > $@; fi + @PERL@ $(srcdir)/completion.pl --opts-dir $(top_srcdir)/docs/cmdline-opts --shell fish > $@ endif install-data-local: if USE_ZSH_COMPLETION - if test -n "$(PERL)"; then \ - $(MKDIR_P) $(DESTDIR)$(ZSH_FUNCTIONS_DIR); \ - $(INSTALL_DATA) $(ZSH_COMPLETION_FUNCTION_FILENAME) $(DESTDIR)$(ZSH_FUNCTIONS_DIR)/$(ZSH_COMPLETION_FUNCTION_FILENAME); \ - fi + $(MKDIR_P) $(DESTDIR)@ZSH_FUNCTIONS_DIR@ + $(INSTALL_DATA) $(ZSH_COMPLETION_FUNCTION_FILENAME) $(DESTDIR)@ZSH_FUNCTIONS_DIR@/$(ZSH_COMPLETION_FUNCTION_FILENAME) endif if USE_FISH_COMPLETION - if test -n "$(PERL)"; then \ - $(MKDIR_P) $(DESTDIR)$(FISH_FUNCTIONS_DIR); \ - $(INSTALL_DATA) $(FISH_COMPLETION_FUNCTION_FILENAME) $(DESTDIR)$(FISH_FUNCTIONS_DIR)/$(FISH_COMPLETION_FUNCTION_FILENAME); \ - fi + $(MKDIR_P) $(DESTDIR)@FISH_FUNCTIONS_DIR@ + $(INSTALL_DATA) $(FISH_COMPLETION_FUNCTION_FILENAME) $(DESTDIR)@FISH_FUNCTIONS_DIR@/$(FISH_COMPLETION_FUNCTION_FILENAME) endif distclean: diff --git a/src/Makefile.am b/src/Makefile.am index 14202cf945..a25e84490b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -152,9 +152,9 @@ $(HUGE): $(ASCIIPAGE) $(MKHELP) echo '/* !checksrc! disable LONGLINE all */' >> $(HUGE); \ echo '#include "tool_setup.h"' >> $(HUGE); \ echo '#ifndef HAVE_LIBZ' >> $(HUGE); \ - $(PERL) $(MKHELP) < $(ASCIIPAGE) >> $(HUGE); \ + @PERL@ $(MKHELP) < $(ASCIIPAGE) >> $(HUGE); \ echo '#else' >> $(HUGE); \ - $(PERL) $(MKHELP) -c < $(ASCIIPAGE) >> $(HUGE); \ + @PERL@ $(MKHELP) -c < $(ASCIIPAGE) >> $(HUGE); \ echo '#endif /* HAVE_LIBZ */' >> $(HUGE) ) else # HAVE_LIBZ # This generates the tool_hugehelp.c file uncompressed only @@ -162,7 +162,7 @@ $(HUGE): $(ASCIIPAGE) $(MKHELP) $(HUGECMD)( \ echo '/* !checksrc! disable COPYRIGHT all */' > $(HUGE); \ echo '#include "tool_setup.h"' >> $(HUGE); \ - $(PERL) $(MKHELP) < $(ASCIIPAGE) >> $(HUGE) ) + @PERL@ $(MKHELP) < $(ASCIIPAGE) >> $(HUGE) ) endif else # PERL $(HUGE): @@ -196,7 +196,7 @@ if CURL_CA_EMBED_SET curl_CPPFLAGS += -DCURL_CA_EMBED MK_FILE_EMBED = $(top_srcdir)/src/mk-file-embed.pl $(CA_EMBED_CSOURCE): $(MK_FILE_EMBED) $(CURL_CA_EMBED) - $(PERL) $(MK_FILE_EMBED) --var curl_ca_embed < $(CURL_CA_EMBED) > $(CA_EMBED_CSOURCE) + @PERL@ $(MK_FILE_EMBED) --var curl_ca_embed < $(CURL_CA_EMBED) > $(CA_EMBED_CSOURCE) else $(CA_EMBED_CSOURCE): echo '/* !checksrc! disable COPYRIGHT all */' > $(CA_EMBED_CSOURCE) diff --git a/tests/Makefile.am b/tests/Makefile.am index 58f24c29ce..91102004d0 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -117,7 +117,7 @@ else TEST_COMMON += !documentation endif -TEST = srcdir=$(srcdir) $(PERL) $(PERLFLAGS) $(srcdir)/runtests.pl $(TEST_COMMON) +TEST = srcdir=$(srcdir) @PERL@ $(PERLFLAGS) $(srcdir)/runtests.pl $(TEST_COMMON) TEST_Q = -a -s TEST_AM = -a -am TEST_F = -a -p -r @@ -136,9 +136,9 @@ endif # make sure that PERL is pointing to an executable perlcheck: - @if ! test -x "$(PERL)"; then echo "No perl!"; exit 2; fi + @if ! test -x "@PERL@"; then echo "No perl!"; exit 2; fi -build-certs: +build-certs: perlcheck (cd certs && $(MAKE)) # alias for 'test' to match CMake, where 'test' is a reserved target diff --git a/tests/certs/Makefile.am b/tests/certs/Makefile.am index c9e1e38c3d..d28b1674da 100644 --- a/tests/certs/Makefile.am +++ b/tests/certs/Makefile.am @@ -38,7 +38,7 @@ all-am: test-ca.cacert # Generate all certs in a single shot, but declare just a single target file # to support GNU Make <4.3 without the "grouped explicit targets" feature. test-ca.cacert: $(CERTCONFIG_CA) $(CERTCONFIGS) genserv.pl - $(PERL) $(srcdir)/genserv.pl test $(CERTCONFIGS) + @PERL@ $(srcdir)/genserv.pl test $(CERTCONFIGS) clean-local: rm -f $(GENERATEDCERTS) \