From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id E6C823854142 for ; Mon, 4 Jul 2022 16:27:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E6C823854142 Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-320-R07HsDfMNc-qoESHN3snhw-1; Mon, 04 Jul 2022 12:27:36 -0400 X-MC-Unique: R07HsDfMNc-qoESHN3snhw-1 Received: by mail-wm1-f72.google.com with SMTP id p6-20020a05600c358600b003a0483b3c2eso5571077wmq.3 for ; Mon, 04 Jul 2022 09:27:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=4hM4d6Tls6ExCTtxbVQ0EFE0MKxcMzfou97QrgLE6Bk=; b=HwJUvPgyptOQdWGGHpRVJm3HI2eHXbLvmFC8C54B1on91qUCf7qWWwYAXEKUqPymzz CR9YkY/3xCq/Altp3Hf6Llm5t1ooazzX/fAl7DQwT8PJ4MUPbjSkJKMIK69Ao7dd7BL0 FfADCuK+5w1FBVRW/he7v2UFgSY2rOt+qvM3+vGSt63N6U9sKTLvSJX7lSpyi3bT9Peu LZAZfEiA/E1N7F/3vQMp7ulefb8lsA6Xu//zHC2wGdMs4fc9YNDeMmStzPEN7SAEogAw 1aYjjw059GhFG6B8dNxyZ+zrhDLg7niPdd5c3Pf/zllG3YGCYWCZzTe/EH6/oo4jd00t jaGw== X-Gm-Message-State: AJIora+1DlCJquEomHqZWi4V24f/WPlyuuXWqHK9PR2P1YcRFfpCEwe4 KI15FEGhCZw1PaA61OpWhTmZh5Qk+dYEXFR0994iYbyVoEwhzTV9BvZhVj7uFy9RznCLnHvjhxu 00zesCU5y+95u9mbUS0WZeYzk3RPwPwPF4jl/njgcW46TTkHfvS+xJTuW/1koIPDOcJDPVvMX8g == X-Received: by 2002:adf:d206:0:b0:21d:6434:a158 with SMTP id j6-20020adfd206000000b0021d6434a158mr10332064wrh.37.1656952055244; Mon, 04 Jul 2022 09:27:35 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uHx71j5OjVNYDy8Sym/rcApIGzkyktnOMXKrUAOF7tcuiXZaVKHJE+dGHCLSiIbNjXwncB2w== X-Received: by 2002:adf:d206:0:b0:21d:6434:a158 with SMTP id j6-20020adfd206000000b0021d6434a158mr10332037wrh.37.1656952054982; Mon, 04 Jul 2022 09:27:34 -0700 (PDT) Received: from localhost (15.72.115.87.dyn.plus.net. [87.115.72.15]) by smtp.gmail.com with ESMTPSA id a3-20020a056000100300b0021b943a50b3sm31185173wrx.85.2022.07.04.09.27.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Jul 2022 09:27:34 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCH] gdb/python: look for python, then python 3 at configure time Date: Mon, 4 Jul 2022 17:27:31 +0100 Message-Id: <20220704162731.258145-1-aburgess@redhat.com> X-Mailer: git-send-email 2.25.4 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-10.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jul 2022 16:27:42 -0000 It is possible that a system might have a python3 executable, but no python executable. For example, on my Fedora system the python2 package provides /usr/bin/python2, the python3 package provides /usr/bin/python3, and the python-unversioned-command package provides /usr/bin/python, which picks between python2 and python3. It is quite possible to only have python3 available on a system. Currently, when GDB configures, it looks for a 'python' executable. If non is found then GDB will be built without python support. Or the user needs to configure using --with-python=/usr/bin/python3. This commit updates GDB's configure.ac script to first look for 'python', and then 'python3'. Now, on a system that only has a python3 executable, GDB will automatically find, and use that in order to provide python support, no user supplied configure arguments are needed. I've tested this on my local machine by removing the python-unversioned-command package, confirming that there is no longer a 'python' executable in my $PATH, and then rebuilding GDB from scratch. GDB with this patch has python support. --- gdb/configure | 12 +++++++++--- gdb/configure.ac | 3 ++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/gdb/configure b/gdb/configure index 1b821390801..4b5e031bff9 100755 --- a/gdb/configure +++ b/gdb/configure @@ -11098,8 +11098,11 @@ else case "${with_python}" in yes | auto) if test "${build}" = "${host}"; then - # Extract the first word of "python", so it can be a program name with args. -set dummy python; ac_word=$2 + # Look first for 'python', then 'python3'. + for ac_prog in python python3 +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_python_prog_path+:} false; then : @@ -11125,7 +11128,6 @@ done done IFS=$as_save_IFS - test -z "$ac_cv_path_python_prog_path" && ac_cv_path_python_prog_path="missing" ;; esac fi @@ -11139,6 +11141,10 @@ $as_echo "no" >&6; } fi + test -n "$python_prog_path" && break +done +test -n "$python_prog_path" || python_prog_path="missing" + if test "${python_prog_path}" = missing; then python_prog=missing else diff --git a/gdb/configure.ac b/gdb/configure.ac index bf03b875dfe..b681988d7a4 100644 --- a/gdb/configure.ac +++ b/gdb/configure.ac @@ -811,7 +811,8 @@ else case "${with_python}" in yes | auto) if test "${build}" = "${host}"; then - AC_PATH_PROG(python_prog_path, python, missing) + # Look first for 'python', then 'python3'. + AC_PATH_PROGS(python_prog_path, [python python3], missing) if test "${python_prog_path}" = missing; then python_prog=missing else -- 2.25.4