build: Correct dependencies for module files.

Without the correct dependencies, parallel builds fail due to missing
modules.
Add scotch files to .gitignore.
build: Remove scotch from specfem2d Makefile.

It's only used in the mesher, and the search path was wrong when used
here anyway.
Move constant_Q2_sub functions closer to their use.

Also, move them away from the NR functions.
Use proper ANSI prototyping.
Fix calls to exit function.

Just placing the word exit there does nothing.
Remove unused variables.
Remove unnecessary macros.

* MAX can be replaced by fmax.
* SIGN can be replaced by copysign.
* PYTHAG can be replaced by hypot.

The last two require C99, but since we require Fortran2003, I don't
think that's a big deal.
Use proper C indexing.

No more of this pseudo-Fortran indexing. It's odd and causes unnecessary
work (to be fixed).
Remove unnecessary allocations and loops.
Add missing header.

ctype.h is required for isspace.
Use MPI_STATUS_IGNORE in MPI calls.

The status is not used, so this saves us an extra variable or two.
Fix some simple type-conversion warnings.
build: Make changes to scotch build permanent.

Every time you configured with internal scotch, you'd get modifications
to its Makefiles which git would show as modified. This is troublesome
whenever you want to commit or change branches, because you'd have to
remember not to keep those changes.

The changes to the scotch Makefiles are independent of any options you
might pass to configure (except that they aren't done if you aren't
using internal scotch). We can just make them permanently in git,
especially because the changes have been made upstream in scotch as
well.
build: Rename a build script.

It's a bit confusing to call it 'makefile' when it's just a shell script
and not intended to be used with Make at all.
Use POSIX syntax for shell scripts.

This should be more portable, but most scripts are really just a list of
commands, making little difference. Tested with bash and dash (which is
POSIX compliant, but doesn't implement most of bash's extensions).
Fix several warnings in Perl script.

I wonder if we should just remove this commented code, though.
Remove some unused subroutines.
build: Fix dependency of part_unstruct.f90 on scotch.

Without this dependency, parallel builds fail due to missing scotchf.h.