]> git.cworth.org Git - fips/commitdiff
configure: Add an early check for a functional C compiler
authorCarl Worth <cworth@cworth.org>
Thu, 13 Jun 2013 22:00:49 +0000 (15:00 -0700)
committerCarl Worth <cworth@cworth.org>
Thu, 13 Jun 2013 22:09:41 +0000 (15:09 -0700)
Without this, later compiler-based checks for header files, etc. would
falsely claim that libraries were not installed, (when in fact, the
libraries were installed but the compiler-based checks were failing
because no compiler is available).

configure

index 7c5a38ce6e2dae6f3d4cf075081e81231c92747d..9428296b75825aef8b26e08f9a3c6e099189c3b7 100755 (executable)
--- a/configure
+++ b/configure
@@ -217,6 +217,32 @@ exit 1
 
 fi
 
+printf "Checking for working C compiler (${CC})... "
+printf "int main(void){return 42;}\n" > minimal.c
+if ${CC} -o minimal minimal.c > /dev/null 2>&1
+then
+    printf "Yes.\n"
+else
+    printf "No.\n"
+    cat <<EOF
+
+*** Error: No functioning C compiler found. Either set the CC environment
+to a working C compiler, or else install gcc:
+
+       http://gcc.gnu.org/
+
+You may be able to install gcc with a command such as:
+
+       sudo apt-get install build-essential
+    or:
+       sudo yum install make automake gcc gcc-c++ kernel-devel
+
+EOF
+
+exit 1
+
+fi
+
 printf "Checking for libtalloc... "
 if pkg-config --exists talloc; then
     printf "Yes.\n"