From patchwork Wed Apr 24 11:00:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Giulio Benetti X-Patchwork-Id: 1100 Return-Path: Received: from mail.micronovasrl.com (mail.micronovasrl.com [212.103.203.10]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 3448860DB4 for ; Wed, 24 Apr 2019 13:00:50 +0200 (CEST) Received: from mail.micronovasrl.com (mail.micronovasrl.com [127.0.0.1]) by mail.micronovasrl.com (Postfix) with ESMTP id E8500B0067F for ; Wed, 24 Apr 2019 13:00:49 +0200 (CEST) Authentication-Results: mail.micronovasrl.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=micronovasrl.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=micronovasrl.com; h=references:in-reply-to:x-mailer:message-id:date:date:subject :subject:to:from:from; s=dkim; t=1556103649; x=1556967650; bh=yQ GfnMYf5LN5nTypVnVmtCXSzoZBFx6U1IcbdqBAHGk=; b=jIqi8lRTv6E+YY/vMr kNBNyzCMAMPqlo4AuwDB+TkTNRaIK2RSZ0xMfBgGj6Ns8rhyq/AkespYJxVAkYZ1 AjQQGTGAQScVCnwMIoUlI1TNNMeWVwginQtmGtPfTODu9j+zWh1orftBYIpd1pDS KiJ8GdOE/laB4i9zrjj0EH64I= X-Virus-Scanned: Debian amavisd-new at mail.micronovasrl.com X-Spam-Flag: NO X-Spam-Score: -2.9 X-Spam-Level: X-Spam-Status: No, score=-2.9 tagged_above=-10 required=4.5 tests=[ALL_TRUSTED=-1, BAYES_00=-1.9] autolearn=unavailable autolearn_force=no Received: from mail.micronovasrl.com ([127.0.0.1]) by mail.micronovasrl.com (mail.micronovasrl.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id vDdjjH0f-eDW for ; Wed, 24 Apr 2019 13:00:49 +0200 (CEST) Received: from ubuntu.localdomain (88-149-228-83.v4.ngi.it [88.149.228.83]) by mail.micronovasrl.com (Postfix) with ESMTPSA id 11BF9B00E68; Wed, 24 Apr 2019 13:00:48 +0200 (CEST) From: Giulio Benetti To: libcamera-devel@lists.libcamera.org Date: Wed, 24 Apr 2019 13:00:43 +0200 Message-Id: <20190424110044.12608-2-giulio.benetti@micronovasrl.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190424110044.12608-1-giulio.benetti@micronovasrl.com> References: <364aa322-85ca-2c17-984e-1e807bd832ca@micronovasrl.com> <20190424110044.12608-1-giulio.benetti@micronovasrl.com> Subject: [libcamera-devel] [PATCH 1/2] meson: check if secure_getenv() is present X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Apr 2019 11:00:50 -0000 Not all libc make secure_getenv() available, this could lead to build failure on certain build systems. Check if secure_getenv() and emit #define HAVE_SECURE_GETENV to config.h Include config.h to every c/c++ file during building by adding `-include config.h` to project arguments for both c and c++. Signed-off-by: Giulio Benetti --- meson.build | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/meson.build b/meson.build index 6e68c3e..ee9f5bf 100644 --- a/meson.build +++ b/meson.build @@ -25,6 +25,18 @@ add_project_arguments(cpp_arguments, language: 'cpp') libcamera_includes = include_directories('include') +cc = meson.get_compiler('c') +config_h = configuration_data() + +if cc.has_header_symbol('stdlib.h', 'secure_getenv', prefix: '#define _GNU_SOURCE') + config_h.set('HAVE_SECURE_GETENV', 1) +else + message('C library does not support secure_getenv, using getenv instead') +endif +configure_file(output: 'config.h', configuration: config_h) +add_project_arguments('-include', 'config.h', language: 'c') +add_project_arguments('-include', 'config.h', language: 'cpp') + subdir('include') subdir('src') subdir('utils')