From patchwork Sat Aug 26 14:34:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Timo Rothenpieler X-Patchwork-Id: 43332 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:7194:b0:149:dfde:5c0a with SMTP id s20csp460685pzb; Sat, 26 Aug 2023 07:34:52 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE+72Ny/MnK8O6ZTor5DTGJ4Urtn+jrMT0s2VppVuXyoj+bjdwuvMSaWPn12aaV00xzTLre X-Received: by 2002:a17:906:74cf:b0:9a2:b89:f82a with SMTP id z15-20020a17090674cf00b009a20b89f82amr5623736ejl.49.1693060492067; Sat, 26 Aug 2023 07:34:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693060492; cv=none; d=google.com; s=arc-20160816; b=s09fHNQMBB8PiDxGKZvvIty9UG17fj5/e35XNXelELlZqxMx463H006RTJNZeMm5ir 4uwkMRPYZ9UolBPHc1g3468l8yeTkOiTZT4FqAinXxZlSeZgRwBiGNidOxyGemiArQJw QzZuar1RATsJW8Qpuj7IkqPil4vEXAPrZEsGZK2mRD8SUbbRONmgvj75GzYxWhuMl/m2 JNlNrGTplwlZFWCZ1gv/VQPaBg9l0tlb8NypRA87KAaEnNiLQ+xnuVx2/RW9i5aU7ghf MvCULjWXebNShaatiSI5pTEVajmodQ0kf4Bx/iF04UcISVCCXMeXWsoXc3+CG788q98W En4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:message-id:date:to:from :dkim-signature:delivered-to; bh=J5yN15n4DoREGny0qmN9woK94O5PXX8acgkSAz6ramY=; fh=LnlYe9qYwgML7nWWXqAumr7YCmPjjpEPjQf6GasgJC0=; b=zGYCER0aDet51wRJLBG4BAGzHxKa0ljbJqE/HktJ8Kx1Jm2x5M3ydLBqmsnIeXSe6x uSsbaOrkiFocid0HAwlmqmPHzyC9jW4Q6n+wLW+PrIIqkuhHEiL5T/UpAooN35+4/ID1 SzoWwtpemzEfcu58OJIrKuZSrAQ1pUPI7Q8KSfSV0T8ebe6iLvdmZ81OAbn55o50ZkCg emwPpe3jY9CQSaX42C/PBOewe1DoJ3wmk8iyIWpmZJg9G/CNtfq8wUVNHMhiKB0plKlx zVo1SEZJ0Oi2Dnk2ZmthBiELv8il7ZQ1DpkwbtvhDFtfIapPucUDY0tVq88wuQM6JfZ6 dRjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@rothenpieler.org header.s=mail header.b=QB+SxrZu; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=rothenpieler.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id i2-20020a1709064ec200b0099cbf068b6bsi288827ejv.588.2023.08.26.07.34.48; Sat, 26 Aug 2023 07:34:52 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@rothenpieler.org header.s=mail header.b=QB+SxrZu; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=rothenpieler.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9047068C5D1; Sat, 26 Aug 2023 17:34:44 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from btbn.de (btbn.de [136.243.74.85]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 11EE368A05D for ; Sat, 26 Aug 2023 17:34:37 +0300 (EEST) Received: from [authenticated] by btbn.de (Postfix) with ESMTPSA id 1C2D936CFB7; Sat, 26 Aug 2023 16:34:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rothenpieler.org; s=mail; t=1693060476; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=8MBGRNnFYMDIeGLoeAZe/UmEh2gEXEu/BVAzc+aVPkI=; b=QB+SxrZuobcoc34afotRFBuwEwYV00EIe0H8WqkDpPcY/fQ8xvtLGiLJArP3+KyZeGuKpi kPX4GdGtTlGzXuiLI1N1LJ+QXDwXvp6MBvOusq1zHIjNsEVkxUTO2IqscNxWLcKarIs9S2 /h45unjc+T/bNcrKSb2PwQudo/Q/XDTj4wbodguC3MByGhuy2dLfulJUEi1oLVWU7DCQWU bNoT3BiixwxE4xyNLlI+Ac5GUjFyMEr1jRZqpr0tlEb8IdelKeBTwfGWB+mWRR/rw+U997 rSihwFJf+wL3O7x7qo6pSgDNVwf0WmPOyeGfd2he/zLz6zbmU903ZG2K/MQEqg== From: Timo Rothenpieler To: ffmpeg-devel@ffmpeg.org Date: Sat, 26 Aug 2023 16:34:28 +0200 Message-Id: <20230826143428.1347-1-timo@rothenpieler.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] configure: fix --custom-allocator X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Timo Rothenpieler Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: OlfEOJODKsfd The custom-allocator logic has been completely defunct since a while, since nothing depends on those targets, they never get used. This updates jemalloc to pkg-config, adds the fallback option for potential arbitrary allocators, and finally actually adds the libraries to LDFLAGS. --- configure | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/configure b/configure index c1e592729a..de00bd14e6 100755 --- a/configure +++ b/configure @@ -6369,16 +6369,28 @@ if enabled float16; then fi case "$custom_allocator" in + "") + ;; jemalloc) - # jemalloc by default does not use a prefix - require libjemalloc jemalloc/jemalloc.h malloc -ljemalloc + test -n "$malloc_prefix" || + malloc_prefix=$($pkg_config --variable=jemalloc_prefix $pkg_config_flags jemalloc 2>/dev/null) + require_pkg_config custom_allocator jemalloc jemalloc/jemalloc.h ${malloc_prefix}malloc ;; tcmalloc) - require_pkg_config libtcmalloc libtcmalloc gperftools/tcmalloc.h tc_malloc + require_pkg_config custom_allocator libtcmalloc gperftools/tcmalloc.h tc_malloc malloc_prefix=tc_ ;; + *) + require_pkg_config custom_allocator "$custom_allocator" stdlib.h malloc + ;; esac +if test -n "$custom_allocator"; then + # this library import has to happen as far "left" on the linker commandline as possible, + # hence add it directly to LDFLAGS. + add_ldflags "$custom_allocator_extralibs" +fi + check_func_headers malloc.h _aligned_malloc && enable aligned_malloc check_func ${malloc_prefix}memalign && enable memalign check_func ${malloc_prefix}posix_memalign && enable posix_memalign