Do not include the autoconf config.h file if NO_CONFIG is defined
Check if __STDC_FORMAT_MACROS is already defined before defining it again
Check target_index return before using.
Fix calling target_thread_make_current with tid