[autotools] Fixes precedence issues in LDADD flags.

LDADD contained DUNE_LIBS twice in addition the order of the libraries
was often just wrong. Libraries with symbols needed by another library
must come after it in LDADD.

The mixup caused a lot of trouble with static libraries and and linking
via -Llibpath -llibname, see https://dune-project.org/flyspray/index.php?do=details&task_id=1413