]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
configure: if no perl, disable unity and shell completion, related tidy ups
authorViktor Szakats <commit@vsz.me>
Fri, 1 Aug 2025 22:18:12 +0000 (00:18 +0200)
committerViktor Szakats <commit@vsz.me>
Mon, 4 Aug 2025 12:55:10 +0000 (14:55 +0200)
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

.github/workflows/linux.yml
.github/workflows/macos.yml
Makefile.am
configure.ac
scripts/Makefile.am
src/Makefile.am
tests/Makefile.am
tests/certs/Makefile.am

index cea06e814dea7acc7e1c6020b05a51aacb91b108..be0468ff8dc61f10ee6d2217201aab366439355d 100644 (file)
@@ -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') }}
index b35c9a08c4bdabd2e19ff2be8ede82bfaf5b37a5..cdb6de28346c154980dc89129429b2d764a5e580 100644 (file)
@@ -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: |
index 515fa3c8b420de868e6704735842e6b225f8326f..08af6cd028be9bc52ea4a83c8aae98246676d3d9 100644 (file)
@@ -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 ; \
index a76761d7974327e9fc431e33f837db7d95506081..534826103307d5f39401811de337e73c3bb079ac 100644 (file)
@@ -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
index 2c98aac9f7b60a589f6024689ff0698d48e8b908..cfa3d3e740a9328c44ac25afc94848ee03d1da81 100644 (file)
@@ -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:
index 14202cf9450d0c0e823f206af47779d50f6f04fd..a25e84490b9597250f555391f350a1f868434121 100644 (file)
@@ -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)
index 58f24c29cee7713a6657078447a8bde7ec8b8fb5..91102004d0b7b0aaa3248f6ee56bd7b6d013a71f 100644 (file)
@@ -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
index c9e1e38c3de00ef33e3f81f041bbda423143286e..d28b1674da3d1bc3e7052151d4f09064ebe942e3 100644 (file)
@@ -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) \