Two somewhat related fixes to the PNG decoder

1: Handle any number of PNG chunks (up to the available memory)

2: Stop decoding once the IEND chunk has been processed.

This fixes opera bug TURBO2-767:
   Crash when decoding http://extrafahaz.hu/fotok/image052e.png

The image in the bug has a lot of data appended after the IEND chunk,
and in total after decoding there was 339017 chunks.

Since the decoder used the stack to build the array this meant that it
had a tendency ran out of stack space, and caused fairly random
crashes.

Fixed by simply avoiding the stack, instead an array is built
directly.

Also, the PNG format says that the file ends after the IEND chunk, the
decoder now enforces that, which makes the file decode significantly
faster (now ~60 chunks instead of 339k).
Mysql: Improved library detection.

MariaDB is often installed without the mariadb client library
(but with the mysql client library), so search for the mysql
client library if the mariadb client library can't be found.

Also adds searching for reentrant versions of the client libraries.

Fixes compilation issues on machines with MariaDB server but
not MariaDB client.
Indent preprocessor directives in set_priority().

(cherry picked from commit 56a199cd3f0d7b2866e59e4562c23d8c4449b6e4)
set_priority(): add "normal" as a priority.

This makes it possible to return to the default priority in a
documented way.

(cherry picked from commit 2d3e79777cd88b5c708447fba1b68783136539a0)
set_priority(): simplify code.

Simplify an expression by removing a multiply-by-0 part of an
expression.

(cherry picked from commit f91b7e2e5519ca66700fee7ddc56f3e7b2c764a9)
set_priority(): Fix going from realtime to normal priorities.

The following code sequence (and many others) used to fail on systems
that have both the sched_setscheduler() and setpriority() syscalls:

    set_priority("realtime");
    set_priority("lower");

The first call would set the policy to SCHED_FIFO.  The second call
would not touch the policy, but just use setpriority().  The result is
that the process continues to run with realtime priority.

Fix by ensuring that the code calls both sched_setscheduler() and
setpriority() when SCHED_OTHER is in effect.

At the same time, reorganize the code somewhat to be more readable.

(cherry picked from commit 48aa6ad98e390fb68e2055fa67f951e5fb32159f)

Conflicts:
	src/signal_handler.c (trivial memset/MEMSET conflict)
set_priority(): Raise an error on unsupported priorities.

Previously, the were handled as "normal".

(cherry picked from commit 1f8eb4566cc6b5e23e1d7084ec3d4f30f739145a)
set_priority(): Use SCHED_IDLE for priority "lowest".

On systems with sched_setscheduler and where SCHED_IDLE is defined,
use it when setting the priority to "lowest".

(cherry picked from commit 23e8e5699409887476005611ec6e6ce341a87f00)
Fixed warning.

(cherry picked from commit 0994f941f38b9b5361a653bf01b9453bd3500e7c)

Conflicts:
	src/signal_handler.c (trivial memset/MEMSET issue)