LibIRCClient 1.10 Used by Probotic
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

116 lines
3.0KB

  1. # -*- Autoconf -*-
  2. # Process this file with autoconf to produce a configure script.
  3. AC_PREREQ(2.52)
  4. AC_INIT(libircclient, 1.3, gyunaev@ulduzsoft.com)
  5. AC_CONFIG_SRCDIR([include/libircclient.h])
  6. AC_CONFIG_HEADER([src/config.h])
  7. # Check for command-line
  8. AC_ARG_ENABLE([debug],
  9. [AS_HELP_STRING([--enable-debug],
  10. [compile with debug information (no)])],
  11. [use_debug=$enableval],
  12. [use_debug=no])
  13. AC_ARG_ENABLE([shared],
  14. [AS_HELP_STRING([--enable-shared],
  15. [build a shared library (no)])],
  16. [build_shared=$enableval],
  17. [build_shared=no])
  18. AC_ARG_ENABLE([threads],
  19. [AS_HELP_STRING([--enable-threads],
  20. [compile with multithread support (yes)])],
  21. [use_threads=$enableval],
  22. [use_threads=yes])
  23. AC_ARG_ENABLE([ipv6],
  24. [AS_HELP_STRING([--enable-ipv6],
  25. [compile with IPv6 support (no)])],
  26. [use_ipv6=$enableval],
  27. [use_ipv6=no])
  28. AC_ARG_ENABLE([openssl],
  29. [AS_HELP_STRING([--enable-openssl],
  30. [compile with OpenSSL support (no)])],
  31. [use_openssl=$enableval],
  32. [use_openssl=no])
  33. # Checks for programs.
  34. AC_PROG_CXX
  35. AC_PROG_CC
  36. AC_CHECK_TOOL(AR, ar, :)
  37. AC_PROG_RANLIB
  38. # Checks for header files.
  39. AC_HEADER_STDC
  40. # Checks for typedefs, structures, and compiler characteristics.
  41. AC_HEADER_STDBOOL
  42. AC_C_CONST
  43. AC_TYPE_SIZE_T
  44. AC_HEADER_TIME
  45. # Checks for library functions.
  46. AC_FUNC_MALLOC
  47. AC_FUNC_SELECT_ARGTYPES
  48. AC_FUNC_STAT
  49. AC_CHECK_FUNCS([localtime_r socket])
  50. AC_CHECK_LIB(socket, socket, AC_DEFINE(HAVE_SOCKET) LIBS="$LIBS -lsocket")
  51. if test "$use_debug" = "yes"; then
  52. CFLAGS="${CFLAGS} -g -DENABLE_DEBUG"
  53. else
  54. CFLAGS="${CFLAGS} -O3"
  55. fi
  56. # Choosing the target
  57. TARGET="static"
  58. if test "$build_shared" = "yes"; then
  59. CFLAGS="$CFLAGS -fpic"
  60. TARGET="shared"
  61. fi
  62. if test "$use_ipv6" = "yes"; then
  63. AC_CHECK_FUNCS([getaddrinfo inet_pton])
  64. AC_CHECK_LIB(nsl, getaddrinfo, AC_DEFINE(HAVE_GETADDRINFO) LIBS="$LIBS -lnsl")
  65. CFLAGS="$CFLAGS -DENABLE_IPV6"
  66. else
  67. AC_CHECK_FUNCS([gethostbyname_r inet_ntoa])
  68. AC_CHECK_LIB(nsl, inet_ntoa, AC_DEFINE(HAVE_INET_NTOA) LIBS="$LIBS -lnsl")
  69. fi
  70. if test "$use_threads" = "yes"; then
  71. CFLAGS="$CFLAGS -DENABLE_THREADS -D_REENTRANT"
  72. fi
  73. # Checking for mingw
  74. AC_MSG_CHECKING([For MinGW32])
  75. case "$host" in
  76. *-*-mingw*)
  77. AC_MSG_RESULT([yes])
  78. CFLAGS="$CFLAGS -DWIN32_DLL"
  79. LIBS="$LIBS -lz -lwsock32 -lgdi32 -lkernel32" # for openssl
  80. TARGET="shared_mingw"
  81. ;;
  82. *) AC_MSG_RESULT([no]) ;;
  83. esac
  84. if test "$use_openssl" = "yes"; then
  85. AC_CHECK_LIB(crypto, [CRYPTO_free], [], [AC_MSG_ERROR([OpenSSL not found (libcrypto)])])
  86. AC_CHECK_LIB(ssl, [SSL_CTX_new], [], [AC_MSG_ERROR([OpenSSL not found (libssl)])])
  87. AC_CHECK_HEADER([openssl/ssl.h], [], [AC_MSG_ERROR([OpenSSL headers not found; did you install the -dev package?])])
  88. CFLAGS="$CFLAGS -DENABLE_SSL"
  89. fi
  90. AC_SUBST(TARGET)
  91. AC_SUBST(CFLAGS)
  92. AC_SUBST(LDFLAGS)
  93. AC_SUBST(LIBS)
  94. AC_SUBST(PREFIX)
  95. AC_CONFIG_FILES([examples/Makefile src/Makefile])
  96. AC_OUTPUT