configure: add general libs for Solaris
[fio.git] / configure
index 87cc1cff8fa1f3691d16d7474753758d975cd2e3..1a75fa4830555f871f266b9c03e24e0d10595948 100755 (executable)
--- a/configure
+++ b/configure
@@ -87,7 +87,7 @@ compile_object() {
 
 compile_prog() {
   local_cflags="$1"
-  local_ldflags="$2"
+  local_ldflags="$2 $LIBS"
   echo "Compiling test case $3" >> config.log
   do_cc $CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags
 }
@@ -161,7 +161,9 @@ if test "$show_help" = "yes" ; then
   exit $exit_val
 fi
 
-if check_define __linux__ ; then
+if check_define __ANDROID__ ; then
+  targetos="Android"
+elif check_define __linux__ ; then
   targetos="Linux"
 elif check_define __OpenBSD__ ; then
   targetos='OpenBSD'
@@ -191,6 +193,7 @@ SunOS)
   if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
     cpu="x86_64"
   fi
+  LIBS="-lnsl -lsocket"
   ;;
 CYGWIN*)
   echo "Forcing known good options on Windows"
@@ -222,6 +225,17 @@ CYGWIN*)
   echo "CC=$CC" >> $config_host_mak
   echo "EXTFLAGS=$CFLAGS -include config-host.h -D_GNU_SOURCE" >> $config_host_mak
   exit 0
+  ;;
+Android)
+  output_sym "CONFIG_32BIT"
+  output_sym "CONFIG_LITTLE_ENDIAN"
+  output_sym "CONFIG_SOCKLEN_T"
+  output_sym "CONFIG_GETTIMEOFDAY"
+  output_sym "CONFIG_CLOCK_GETTIME"
+  output_sym "CONFIG_CLOCK_MONOTONIC"
+  echo "CC=$cc" >> $config_host_mak
+  echo "EXTFLAGS=$CFLAGS -include config-host.h -DFIO_NO_HAVE_SHM_H -D_GNU_SOURCE" >> $config_host_mak
+  exit 0
 esac
 
 if test ! -z "$cpu" ; then
@@ -336,7 +350,7 @@ int main(void)
 }
 EOF
 if compile_prog "" "" "wordsize"; then
-  wordsize=$($TMPE)
+  wordsize=`$TMPE`
 fi
 echo "Wordsize                      $wordsize"
 
@@ -896,6 +910,23 @@ if compile_prog "" "" "TCP_NODELAY"; then
 fi
 echo "TCP_NODELAY                   $tcp_nodelay"
 
+##########################################
+# Check whether we have RLIMIT_MEMLOCK
+rlimit_memlock="no"
+cat > $TMPC << EOF
+#include <sys/time.h>
+#include <sys/resource.h>
+int main(int argc, char **argv)
+{
+  struct rlimit rl;
+  return getrlimit(RLIMIT_MEMLOCK, &rl);
+}
+EOF
+if compile_prog "" "" "RLIMIT_MEMLOCK"; then
+  rlimit_memlock="yes"
+fi
+echo "RLIMIT_MEMLOCK                $rlimit_memlock"
+
 #############################################################################
 
 echo "# Automatically generated by configure - do not modify" > $config_host_mak
@@ -1004,6 +1035,9 @@ fi
 if test "$tcp_nodelay" = "yes" ; then
   output_sym "CONFIG_TCP_NODELAY"
 fi
+if test "$rlimit_memlock" = "yes" ; then
+  output_sym "CONFIG_RLIMIT_MEMLOCK"
+fi
 
 echo "LIBS+=$LIBS" >> $config_host_mak
 echo "CC=$cc" >> $config_host_mak