AyushP123

fork

Jul 3rd, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.97 KB | None | 0 0
  1. REMOTE_LIBS=
  2. if test "$enable_backend_remote" = yes ; then
  3.   AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
  4. #ifdef __WIN32__
  5. #error WIN32
  6. #endif
  7.   ]])], [win32=no], [win32=yes])
  8.  
  9.   case $host_os-$win32 in
  10.     *-yes )
  11.       dnl For mingw and msvc we have an alternative implementation which
  12.       dnl doesn't need fork() or socketpair().
  13.      dnl
  14.      dnl We need -lws2_32 for getaddrinfo(), etc.
  15.      REMOTE_LIBS=-lws2_32
  16.      dnl Vista is needed for the AI_ADDRCONFIG flag to getaddrinfo().
  17.      AC_DEFINE([WINVER], [0x600],
  18.         [Version of Windows to assume (0x600 => Vista).])
  19.      AC_DEFINE([_WIN32_WINNT], [WINVER],
  20.         [Version of Windows to assume.])
  21.      ;;
  22.    *djgpp* | *msdos* )
  23.      dnl DJGPP has a dummy implementation of fork which always fails.
  24.      dnl
  25.      dnl For disk-based backend, use flock() for locking, which doesn't need
  26.       dnl fork() or socketpair().
  27.       AC_DEFINE([FLINTLOCK_USE_FLOCK], 1, [Define to use flock() for flint-compatible locking])
  28.       dnl If someone actually wanted remote backend support, then DJGPP has a
  29.       dnl pthreads port, so using threads like we do on Windows would make more
  30.       dnl sense.
  31.       enable_backend_remote=no
  32.       ;;
  33.     *)
  34.       dnl On Unix, we need fork and socketpair for the remotebackend.
  35.       SAVE_LIBS=$LIBS
  36.       AC_CHECK_FUNCS([fork], [], [
  37.     AC_MSG_ERROR([fork() required for the remote backend - if an extra library is needed, pass LIBS=-lfoo to configure.  Or --disable-backend-remote to disable it.)])
  38.       ])
  39.       dnl Check if -lsocket is required for socketpair (Solaris needs it).
  40.       dnl And on Haiku it's in -lnetwork.
  41.      AC_SEARCH_LIBS([socketpair], [socket network], [], [
  42.     AC_MSG_ERROR([socketpair() required for the remote backend - if an extra library is needed, pass LIBS=-lfoo to configure.  Or --disable-backend-remote to disable it.)])
  43.      ])
  44.      AC_DEFINE([HAVE_SOCKETPAIR], [1],
  45.         [Define to 1 if you have the 'socketpair' function.])
  46.      dnl Check if extra libraries are needed for getaddrinfo or inet_ntop()
  47.      dnl (e.g. on Solaris).
  48.      dnl
  49.      dnl We're currently assuming that any system that is worth trying to
  50.       dnl support has getaddrinfo() and inet_ntop(), since these are the
  51.       dnl standard route for supporting IPv6, and that's pretty much essential
  52.      dnl for platforms to support now.
  53.      AC_SEARCH_LIBS([getaddrinfo], [nsl socket], [], [
  54.     AC_MSG_ERROR([getaddrinfo() required for the remote backend - if an extra library is needed, pass LIBS=-lfoo to configure.  Or --disable-backend-remote to disable it.)])
  55.      ])
  56.      AC_SEARCH_LIBS([inet_ntop], [nsl socket], [], [
  57.     AC_MSG_ERROR([inet_ntop() required for the remote backend - if an extra library is needed, pass LIBS=-lfoo to configure.  Or --disable-backend-remote to disable it.)])
  58.      ])
  59.      REMOTE_LIBS=$LIBS
  60.      LIBS=$SAVE_LIBS
  61.      ;;
  62.  esac
  63.  
  64.  if test "$enable_backend_remote" = yes ; then
  65.    TYPE_SOCKLEN_T
  66.    XAPIAN_LIBS="$XAPIAN_LIBS $REMOTE_LIBS"
  67.  fi
  68. fi
Add Comment
Please, Sign In to add comment