title: How to determine the configuration of gcc from a bash script?
body: <p>I have a bash script that compiles a program as well on older versions of Ubuntu (14.04.x and 16.04.x) than on the last one (18.04.x) and on other distributions (Arch, CentOS, Debian, Fedora, etc.) and therefore... with different gcc settings.</p>
  
  <p>Then, to obtain an executable that can be launched (among other ways) by a double click, I must compile this program without the "-no-pie" option with older versions of gcc setting (Ubuntu 14.04.x and 16.04.x) when I have to use this option "=no-pie" for the new version of the gcc 7.3 setting (on Ubuntu 18.04.x).</p>
  
  <p>The problem is that on the last Ubuntu release (18.04.x) and its derivatives (Kubuntu, Xbuntu, etc. and maybe with other distributions) with the new configuration of gcc (7.3) having the option "--enable-default-pie", if I compile my program without the option "-no-pie", the result is that the file created is an executable which is of the "shared library" type which can not be launched by a double click.</p>
  
  <p>My question is either:</p>
  
  <p>a) Is there a command that allows me to determine from a bash script if gcc is configured with the "--enable-default-pie" setting?</p>
  
  <p>b) if not, is there a command that allows me to determine from a bash script if the compiled file is of the "shared library" or "executable" type?</p>
  
  <p>For this second option, a solution could be how to save the response of "gcc -v" in a .txt file and check if there is the "--enable-default-pie" string but I've absolutely no clue how to do it.</p>
  
  <p>If I there is not an answer to my first option, the second option (it is true less elegant but just as effective) would allow me to compile my program first without the "-no-pie" option, then check the status of such a created executable and if the result is a "shared library", of restart this compilation this time using the option "-no-pie" for, in one case as in the other, get an executable that can be launched by a double click whatever the setting of gcc may be.</p>
  
  <p>Thank you in advance for your time, ideas and suggestions.</p>
  
  <p>Best regards. </p>