From: Dima Pasechnik Date: Thu, 26 Feb 2026 20:19:52 +0000 (-0600) Subject: ltmain.in: Support OpenMP with macOS clang X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fa18359d6011eb986951915ffcd37b4289281b53;p=thirdparty%2Flibtool.git ltmain.in: Support OpenMP with macOS clang llvm's OpenMP library using the macOS clang compiler requires prefixing the '-fopenmp' option with '-Xpreprocessor' non-standard option. Reported: https://lists.gnu.org/archive/html/libtool/2026-02/msg00002.html * build-aux/ltmain.in: Process '-Xpreprocessor -fopenmp' as one token. --- diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in index df85f00b0..67175443b 100644 --- a/build-aux/ltmain.in +++ b/build-aux/ltmain.in @@ -4944,6 +4944,16 @@ func_mode_link () # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes + # make sure "-Xpreprocessor -fopenmp" is processed as one token + case $@ in + *-Xpreprocessor\ -fopenmp*) + fopenmp_match="-Xpreprocessor -fopenmp" + ;; + *) + fopenmp_match=-fopenmp + ;; + esac + # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do arg=$1 @@ -5433,7 +5443,7 @@ func_mode_link () continue ;; -mt|-mthreads|-kthread|-Kthread|-pthreads|--thread-safe \ - |-threads|-fopenmp|-fopenmp=*|-openmp|-mp|-xopenmp|-omp|-qsmp=*) + |-threads|$fopenmp_match|fopenmp=*|-openmp|-mp|-xopenmp|-omp|-qsmp=*) func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" @@ -6024,7 +6034,7 @@ func_mode_link () continue ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ - |-threads|-fopenmp|-fopenmp=*|-openmp|-mp|-xopenmp|-omp|-qsmp=*) + |-threads|$fopenmp_match|fopenmp=*|-openmp|-mp|-xopenmp|-omp|-qsmp=*) if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs"