Use stdlib.h instead of the obsolete malloc.h.
Use the POSIX get_cwd() instead of get_current_dir_name().
Use POSIX basename() instead of GNU basename().
Don't try to use gcc flags if the compiler isn't gcc.
Use the detected shared library suffix from cmake in the run.sh scripts.
Merge remote-tracking branch 'upstream/master'