Re: [PATCH] cmake: Default to PNG_ARM_NEON=off for arm targets

John Bowler <[email protected]> Thu, 13 Oct 2022 11:47:34 -0700
Newsgroups gmane.comp.graphics.png.devel
Message-ID <CAP7U39_83BSbmhUSwhMoVdoLXQ5YJ2qwJRCf_mf5ppWao_06hQ@mail.gmail.com>
--===============5628769157000481417==
Content-Type: multipart/alternative; boundary="000000000000fddc1805eaeef101"

--000000000000fddc1805eaeef101
Content-Type: text/plain; charset="UTF-8"

I double checked.  It is exactly as I said; if you do not pass *any*
command line arguments to configure you get the relevant (target) CPU
optimizations compiled in so long as the compiler supports them.  (The
latter check happens in pngpriv.h, which, as I said, is probably the wrong
place.)

Running configure determines the *target *architecture (that's just
configure).  Yes, it's a mess:

https://www.gnu.org/software/autoconf/manual/autoconf-2.68/html_node/Hosts-and-Cross_002dCompilation.html#Hosts-and-Cross_002dCompilation

Then libpng *configure.ac <http://configure.ac>* checks "*host_cpu*", which
happens to work (still) and determines that the value starts with either
"arm" or "aarch64".  Line *384 *of configure.ac sets an automake
conditional called *PNG_ARM_NEON* following the value of "*host_cpu*" to be
'true' for arm/aarch64.  The preceding lines of configure.ac do nothing
unless one of the command line arguments is specified.  *Normal builders of
libpng should never set the command line option*!  This is because it voids
all the careful checking inside the actual source code; I wanted to get rid
of the options but...

Anyway, *PNG_ARM_NEON* Is an *AM_CONDITIONAL*, so to find out what it does
it is necessary to eyeball *Makefile.am*  specifically line *95*.  All that
happens is that the ARM (or other architecture) source code gets added to
the build.  That really is *ALL*; in particular no #defines are set.  So
the build runs with absolutely nothing #defined until the stuff in
pngpriv.h is hit.  This is why nothing "NEON" is set in
scripts/pnglibconf.h.prebuilt and is why the multilib build should work.

--000000000000fddc1805eaeef101
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>I double checked.=C2=A0 It is exactly as I said; if y=
ou do not pass *any* command line arguments to configure you get the releva=
nt (target) CPU optimizations compiled in so long as the compiler supports =
them.=C2=A0 (The latter check happens in pngpriv.h, which, as I said, is pr=
obably the wrong place.)</div><div><br></div>Running configure determines t=
he <b>target </b>architecture (that&#39;s just configure).=C2=A0 Yes, it&#3=
9;s a mess:<div><br></div><div><a href=3D"https://www.gnu.org/software/auto=
conf/manual/autoconf-2.68/html_node/Hosts-and-Cross_002dCompilation.html#Ho=
sts-and-Cross_002dCompilation">https://www.gnu.org/software/autoconf/manual=
/autoconf-2.68/html_node/Hosts-and-Cross_002dCompilation.html#Hosts-and-Cro=
ss_002dCompilation</a><br></div><div><br></div><div>Then libpng <i><a href=
=3D"http://configure.ac">configure.ac</a></i> checks &quot;<b>host_cpu</b>&=
quot;, which happens to work (still) and determines that the value starts w=
ith either &quot;arm&quot; or &quot;aarch64&quot;.=C2=A0 Line <b>384 </b>of=
 <a href=3D"http://configure.ac">configure.ac</a> sets an automake conditio=
nal called <i>PNG_ARM_NEON</i> following the value of &quot;<b>host_cpu</b>=
&quot; to be &#39;true&#39; for arm/aarch64.=C2=A0 The preceding lines of <=
a href=3D"http://configure.ac">configure.ac</a> do nothing unless one of th=
e command line arguments is specified.=C2=A0 <i>Normal builders of libpng s=
hould never set the command line option</i>!=C2=A0 This is because it voids=
 all the careful checking inside the actual source code; I wanted to get ri=
d of the options but...</div><div><br></div><div>Anyway, <i>PNG_ARM_NEON</i=
> Is an <b>AM_CONDITIONAL</b>, so to find out what it does it is necessary =
to eyeball <i>Makefile.am</i>=C2=A0 specifically line <b>95</b>.=C2=A0 All =
that happens is that the ARM (or other architecture) source code gets added=
 to the build.=C2=A0 That really is <i>ALL</i>; in particular no #defines a=
re set.=C2=A0 So the build runs with absolutely nothing #defined until the =
stuff in pngpriv.h is hit.=C2=A0 This is why nothing &quot;NEON&quot; is se=
t in scripts/pnglibconf.h.prebuilt and is why the multilib build should wor=
k.</div><div><br></div></div>

--000000000000fddc1805eaeef101--


--===============5628769157000481417==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline


--===============5628769157000481417==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
png-mng-implement mailing list
png-mng-implement-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/png-mng-implement

--===============5628769157000481417==--