Support platforms that don't have environ in any header (e.g. FreeBSD)
Use /bin/sh rather than /bin/bash for more portability.  The scripts
aren't using anything other than POSIX shell syntax anyway.
Set the open flags correctly for the output:
- We only write so O_WRONLY is more appropriate.
- We should set O_TRUNC because otherwise you end up producing a
  corrupted file if the new output is shorter.
Add execvP to the ExportedSymbolsList so it works on FreeBSD.
Just always define environ ourselves except on the Mac where we don't
use it.  CMake doesn't actually detect it because it's wrapped in
__USE_GNU in unistd.h, the other platforms don't have it anyway.
Declaring it again doesn't hurt anything so just make things simpler.
Improve the handling of the linker options.
- You can use GCC on the Mac and the current detection will be wrong,
  the issue is the the Mac isn't using a GNU ld, which CMake doesn't
  have a way to detect.
- For our purposes we can do the equivalent of what we were doing with
  -exported_sybmols_list, which should avoid symbol conflicts.
Merge pull request #26 from breser/master

More fixes