Mac OS X >= 10.7 support
[runtime.git] / configure.ad
index b2b9b3d4cf8b24ed9e694057761cb715bc6938ad..fd047ab08a69e5fdf278853ede6571c0b51cb83e 100644 (file)
@@ -210,15 +210,27 @@ if test x$want_cpu_optimizations = xtrue; then
     # Other compilers
     if test x$x_have_cpu_sse2 = xtrue; then
       SILC_ADD_CFLAGS(-msse2)
+      SILC_ADD_CFLAGS(-ftree-vectorize)
     fi
     if test x$x_have_cpu_pni = xtrue; then
       SILC_ADD_CFLAGS(-msse3)
+      SILC_ADD_CFLAGS(-ftree-vectorize)
     fi
     if test x$x_have_cpu_ssse3 = xtrue; then
       SILC_ADD_CFLAGS(-mssse3)
+      SILC_ADD_CFLAGS(-ftree-vectorize)
     fi
     if test x$x_have_cpu_sse4_1 = xtrue; then
       SILC_ADD_CFLAGS(-msse4)
+      SILC_ADD_CFLAGS(-ftree-vectorize)
+    fi
+    if test x$x_have_cpu_sse4_2 = xtrue; then
+      SILC_ADD_CFLAGS(-msse4)
+      SILC_ADD_CFLAGS(-ftree-vectorize)
+    fi
+    if test x$x_have_cpu_sse5 = xtrue; then
+      SILC_ADD_CFLAGS(-msse5)
+      SILC_ADD_CFLAGS(-ftree-vectorize)
     fi
   fi
 fi
@@ -242,6 +254,9 @@ case "$target" in
   *-*-*bsd*)
     check_threads=false
     ;;
+  *-*-*darwin*)
+    check_threads=true
+    ;;
   *)
     check_threads=true
     ;;
@@ -414,7 +429,7 @@ AC_CHECK_FUNC(clock_gettime, [],
 # Check for epoll_wait and verify that epoll_create works
 AC_CHECK_FUNC(epoll_wait,
   [
-    AC_RUN_IFELSE(
+    AC_RUN_IFELSE([AC_LANG_SOURCE(
       [
         #include <sys/epoll.h>
         int main()
@@ -425,7 +440,7 @@ AC_CHECK_FUNC(epoll_wait,
           close(ret);
           return 0;
         }
-      ],
+      ])],
       [
         AC_DEFINE([HAVE_EPOLL_WAIT], [1], [HAVE_EPOLL_WAIT])
       ],
@@ -506,7 +521,7 @@ if test x$va_copy = xfalse; then
 fi
 
 if test x$va_copy = xfalse; then
-  AC_RUN_IFELSE(
+  AC_RUN_IFELSE([AC_LANG_SOURCE(
     [
       #include <stdarg.h>
       #include <stdlib.h>
@@ -525,7 +540,7 @@ if test x$va_copy = xfalse; then
       {
         return t(0, 0xff11);
       }
-    ],
+    ])],
     [va_copy=false],
     [
       AC_DEFINE([SILC_VA_COPY_ARRAY], [], [SILC_VA_COPY_ARRAY])
@@ -538,7 +553,7 @@ AC_SUBST(__SILC_VA_COPY)
 
 # Check for timezone and tm_gmtoff for timezone information
 AC_MSG_CHECKING(whether system has timezone)
-AC_RUN_IFELSE(
+AC_RUN_IFELSE([AC_LANG_SOURCE(
   [
     #include <stdio.h>
     #include <time.h>
@@ -547,14 +562,14 @@ AC_RUN_IFELSE(
       timezone = 0;
       return 0;
     }
-  ],
+  ])],
   [ AC_MSG_RESULT(yes)
     AC_DEFINE([HAVE_TIMEZONE], [], [HAVE_TIMEZONE]) ],
   [ AC_MSG_RESULT(no) ],
   [ AC_MSG_RESULT(no) ]
 )
 AC_MSG_CHECKING(whether system has tm_gmtoff)
-AC_RUN_IFELSE(
+AC_RUN_IFELSE([AC_LANG_SOURCE(
   [
     #include <stdio.h>
     #include <time.h>
@@ -564,14 +579,14 @@ AC_RUN_IFELSE(
       tm.tm_gmtoff = 0;
       return 0;
     }
-  ],
+  ])],
   [ AC_MSG_RESULT(yes)
     AC_DEFINE([HAVE_TM_GMTOFF], [], [HAVE_TM_GMTOFF]) ],
   [ AC_MSG_RESULT(no) ],
   [ AC_MSG_RESULT(no) ]
 )
 AC_MSG_CHECKING(whether system has __tm_gmtoff)
-AC_RUN_IFELSE(
+AC_RUN_IFELSE([AC_LANG_SOURCE(
   [
     #include <stdio.h>
     #include <time.h>
@@ -581,14 +596,14 @@ AC_RUN_IFELSE(
       tm.__tm_gmtoff = 0;
       return 0;
     }
-  ],
+  ])],
   [ AC_MSG_RESULT(yes)
     AC_DEFINE([HAVE___TM_GMTOFF], [], [HAVE___TM_GMTOFF]) ],
   [ AC_MSG_RESULT(no) ],
   [ AC_MSG_RESULT(no) ]
 )
 AC_MSG_CHECKING(whether system has __tm_gmtoff__)
-AC_RUN_IFELSE(
+AC_RUN_IFELSE([AC_LANG_SOURCE(
   [
     #include <stdio.h>
     #include <time.h>
@@ -598,7 +613,7 @@ AC_RUN_IFELSE(
       tm.__tm_gmtoff__ = 0;
       return 0;
     }
-  ],
+  ])],
   [ AC_MSG_RESULT(yes)
     AC_DEFINE([HAVE___TM_GMTOFF__], [], [HAVE___TM_GMTOFF__]) ],
   [ AC_MSG_RESULT(no) ],
@@ -779,6 +794,26 @@ AC_ARG_ENABLE(gcov,
   [
     AC_MSG_RESULT(no)
   ])
+
+AC_MSG_CHECKING(whether to have verbose compilation)
+AC_ARG_ENABLE(verbose,
+  [  --enable-verbose        have verbose compilation],
+  [
+    case "${enableval}" in
+      yes)
+        AC_MSG_RESULT(yes)
+
+       # Add here any options to give verbose compilation output
+        SILC_ADD_CFLAGS(-ftree-vectorizer-verbose=2)
+        ;;
+      *)
+        AC_MSG_RESULT(no)
+        ;;
+    esac
+  ],
+  [
+    AC_MSG_RESULT(no)
+  ])
 #endif SILC_DIST_INPLACE
 
 # Debug checking
@@ -895,7 +930,8 @@ AC_ARG_WITH(iconv,
     AC_MSG_RESULT(no)
     AC_CHECK_HEADERS(iconv.h,
       [
-        AC_CHECK_FUNCS(iconv,
+       # Default check for iconv in C-library
+        AC_CHECK_FUNCS(iconv iconv_open iconv_close,
           [
             has_iconv=true
             check_iconv=false
@@ -904,6 +940,7 @@ AC_ARG_WITH(iconv,
   ])
 
 if test x$check_iconv = xtrue; then
+  # Check for iconv in libiconv installed under /usr
   AC_MSG_RESULT(Searching for iconv...)
 
   # XXX
@@ -912,6 +949,10 @@ if test x$check_iconv = xtrue; then
   AC_CHECK_HEADERS(iconv.h,
     [
       LIBS="$LIBS -liconv"
+      LDFLAGS="$LDFLAGS -L/usr/lib"
+      CFLAGS="$CFLAGS -I/usr/include"
+      CPPLAGS="$CPPFLAGS -I/usr/include"
+
       AC_MSG_CHECKING(for iconv in -liconv)
       AC_TRY_LINK(
         [
@@ -946,7 +987,7 @@ if test x$check_iconv = xtrue; then
   SAVE_LDFLAGS="$LDFLAGS"
   SAVE_CPPFLAGS="$CPPFLAGS"
 
-  for dir in `echo "/usr/local /usr/pkg /usr/contrib"`; do
+  for dir in `echo "/usr/local /usr/pkg /usr/contrib /opt/local"`; do
     if test x$has_iconv = xfalse; then
       AC_MSG_RESULT(searching in $dir...)
 
@@ -1004,7 +1045,7 @@ if test x$has_iconv = xtrue; then
   # (2) In glibc-2.1.2 and earlier there is a bug that messes up ob and
   #     obl when args 2 and 3 are 0 (fixed in glibc-2.1.3).
   #
-  AC_CACHE_CHECK([whether this iconv is good enough], ac_iconv_good,
+  AC_CACHE_CHECK([whether this iconv is good enough], ac_cv_iconv_good,
     AC_TRY_RUN(
       [
         #include <iconv.h>
@@ -1023,17 +1064,17 @@ if test x$has_iconv = xtrue; then
         }
       ],
       [
-        ac_iconv_good=yes
+        ac_cv_iconv_good=yes
       ],
       [
-        ac_iconv_good=no
+        ac_cv_iconv_good=no
       ],
       [
-        ac_iconv_good=yes
+        ac_cv_iconv_good=yes
       ])
     )
 
-  if test x$ac_iconv_good = xno; then
+  if test x$ac_cv_iconv_good = xno; then
     AC_MSG_RESULT(Try using libiconv instead.)
   fi
 fi
@@ -1163,7 +1204,7 @@ if test x$has_threads = xtrue; then
   # Check for read/write locks
   AC_CHECK_FUNC(pthread_rwlock_init,
   [
-    AC_RUN_IFELSE(
+    AC_RUN_IFELSE([AC_LANG_SOURCE(
       [
         #include <pthread.h>
         int main()
@@ -1173,7 +1214,7 @@ if test x$has_threads = xtrue; then
           pthread_rwlock_destroy(&rwlock);
           return 0;
         }
-      ],
+      ])],
       [],
       [
        # Rwlock not defined