When I am building software from source on a GNU+Linux system, during the ./configure stage I frequently see the following line:checking for suffix of executables...How do I create such a check in a bash script?The reason I want to know this is that I want to create a makefile in which it compiles with suffix .exe on Cygwin, but no suffix on true GNU+Linux.
Find out extension of executable files?
compiling;executable;make;configure;portability
The test is done by compiling a small dummy C program and by checking how the compiler names the output file.The following example is a simplified version of what configure is doing#!/bin/shcat << EOT > dummy.cint main(int argc, char ** argv) {    return 0;}EOTgcc -o dummy dummy.cif [ -f dummy.exe ] ; then  # exefiI would suggest you to use autoconf to generate a configure script and use it for your purpose.