* */Makefile.in: removed annoying warning:
[fw/sdcc] / sim / ucsim / configure.in
index 2dae014cf752cc1ae0adc4fada16a3a4042e2abb..05ecf9fbe3c7ed18908b6bc75904f9086cb3a480 100644 (file)
@@ -1,5 +1,6 @@
 #!/bin/sh
 
+AC_PREREQ(2.60)
 AC_INIT(.version)
 AC_CONFIG_HEADER(ddconfig.h:ddconfig_in.h)
 
@@ -378,7 +379,6 @@ ucsim_ACCEPT_LENGTH_T
 AC_DEFUN(DD_COPT, [
 AC_CACHE_CHECK(whether $$1 accepts -$2,ucsim_cv_$1$2,
 cat >_test_.c <<EOF
-#include <stdio.h>
 int main(void) {return(0);}
 EOF
 $$1 -v -$2 -c _test_.c 1>&5 2>&5
@@ -390,6 +390,30 @@ fi
 rm -f _test_.* a.out)
 ])
 
+# DD_COPT_NO_IGNORE macro checks if the compiler specified as the
+# 1st parameter supports and doesn't ignore option specified as the
+# 2nd parameter
+# For example: DD_COPT_NO_IGNORE(CXX, fPIC)
+
+AC_DEFUN(DD_COPT_NO_IGNORE, [
+AC_CACHE_CHECK(whether $$1 accepts and doesn't ignore -$2,ucsim_cv_$1$2,
+cat >_test_.c <<EOF
+int main(void) {return(0);}
+EOF
+ucsim_cv_$1$2=$($$1 -v -$2 -c _test_.c 2>&1 1>&5)
+if test "$?" = "0"; then
+  expr "$ucsim_cv_$1$2" : '.*'-$2'.*ignored' 1>&5 2>&5
+  if test "$?" = "0"; then
+    ucsim_cv_$1$2="no"
+  else
+    ucsim_cv_$1$2="yes"
+  fi
+else
+  ucsim_cv_$1$2="no"
+fi
+rm -f _test_.* a.out)
+])
+
 
 # Checking characteristics of compilers and other programs
 # --------------------------------------------------------
@@ -453,13 +477,17 @@ if test "$ucsim_cv_CXXpipe" = "yes"; then
   CXXFLAGS="$CXXFLAGS -pipe"
 fi
 
+# temporary solution to supress GCC 4.2.0 c++ warning:
+# deprecated conversion from string constant to `char *'
+CXXFLAGS="$CXXFLAGS -Wno-write-strings"
+
 PICOPT=""
 SHAREDLIB="no"
-DD_COPT(CXX, fPIC)
+DD_COPT_NO_IGNORE(CXX, fPIC)
 if test "$ucsim_cv_CXXfPIC" = "yes"; then
     PICOPT="-fPIC"
 else
-    DD_COPT(CXX, fpic)
+    DD_COPT_NO_IGNORE(CXX, fpic)
     if test "$ucsim_cv_CXXfpic" = "yes"; then
         PICOPT="-fpic"
     fi
@@ -467,14 +495,6 @@ fi
 if test "$PICOPT"x != "x"; then
     SHAREDLIB="yes"
 fi
-# If this is Cygwin neither use Position Independant Code
-# nor build .so
-# Quick + dirty by Bernhard
-# FIXME
-if $CXX --version 2>&1 | grep -i cygming 1>&5 2>&5 || $CXX --version 2>&1 | grep -i cygwin 1>&5 2>&5; then
-    PICOPT=""
-    SHAREDLIB="no"
-fi
 AC_SUBST(SHAREDLIB)
 AC_SUBST(PICOPT)