configure.ac 4.96 KB
Newer Older
1
AC_INIT([libcloudstorage], [1.2])
2
AM_INIT_AUTOMAKE([foreign subdir-objects tar-pax])
3
AC_CONFIG_MACRO_DIRS([m4])
4
AC_USE_SYSTEM_EXTENSIONS
5 6 7 8

AM_SILENT_RULES([yes])
AM_MAINTAINER_MODE([enable])

Paweł Wegner committed
9
AC_LANG(C++)
10 11

LT_INIT([win32-dll shared disable-static])
12 13 14 15 16

AC_PROG_CXX

AX_CXX_COMPILE_STDCXX_11

17
PKG_CHECK_MODULES([libjsoncpp], [jsoncpp])
Paweł Wegner committed
18
PKG_CHECK_MODULES([libtinyxml2], [tinyxml2])
19

Paweł Wegner committed
20
HAVE_MEGA=0
Paweł Wegner committed
21
AC_ARG_WITH([mega], AS_HELP_STRING([--with-mega]))
Paweł Wegner committed
22
AS_IF([test "x$with_mega" != "xno"], [
Paweł Wegner committed
23 24 25 26 27 28 29
  PKG_CHECK_MODULES([libmega], [libmega], [
    HAVE_MEGA=1
    AC_DEFINE(WITH_MEGA)
  ], [
    HAVE_MEGA=0
    AS_IF([test "x$with_mega" = "xyes"], [AC_MSG_ERROR([libmega not found])])
  ])
Paweł Wegner committed
30
])
Paweł Wegner committed
31
AM_CONDITIONAL([WITH_MEGA], [test "$HAVE_MEGA" -eq 1])
Paweł Wegner committed
32

33
HAVE_CRYPTOPP=0
Paweł Wegner committed
34
AC_ARG_WITH([cryptopp], AS_HELP_STRING([--with-cryptopp]))
35 36 37 38 39 40 41 42
AS_IF([test "x$with_cryptopp" != "xno"], [
  PKG_CHECK_MODULES([libcryptopp], [libcrypto++], [
    HAVE_CRYPTOPP=1
    AC_DEFINE(WITH_CRYPTOPP)
  ], [
    HAVE_CRYPTOPP=0
    AS_IF([test "x$with_mega" = "xyes"], [AC_MSG_ERROR([libcrypto++ not found])])
  ])
Paweł Wegner committed
43
])
44
AM_CONDITIONAL([WITH_CRYPTOPP], [test "$HAVE_CRYPTOPP" -eq 1])
Paweł Wegner committed
45

46
HAVE_CURL=0
47
AC_ARG_WITH([curl], AS_HELP_STRING([--with-curl]))
48 49 50 51 52 53 54 55
AS_IF([test "x$with_curl" != "xno"], [
  PKG_CHECK_MODULES([libcurl], [libcurl], [
    HAVE_CURL=1
    AC_DEFINE(WITH_CURL)
  ], [
    HAVE_CURL=0
    AS_IF([test "x$with_curl" = "xyes"], [AC_MSG_ERROR([libcurl not found])])
  ])
56
])
57
AM_CONDITIONAL([WITH_CURL], [test "$HAVE_CURL" -eq 1])
58

59
HAVE_MICROHTTPD=0
60
AC_ARG_WITH([microhttpd], AS_HELP_STRING([--with-microhttpd]))
61 62 63 64 65 66 67 68
AS_IF([test "x$with_microhttpd" != "xno"], [
  PKG_CHECK_MODULES([libmicrohttpd], [libmicrohttpd], [
    HAVE_MICROHTTPD=1
    AC_DEFINE(WITH_MICROHTTPD)
  ], [
    HAVE_MICROHTTPD=0
    AS_IF([test "x$with_microhttpd" = "xyes"], [AC_MSG_ERROR([libmicrohttpd not found])])
  ])
69
])
70
AM_CONDITIONAL([WITH_MICROHTTPD], [test "$HAVE_MICROHTTPD" -eq 1])
71

Paweł Wegner committed
72
HAVE_FUSE=0
73
HAVE_LEGACY_FUSE=0
Paweł Wegner committed
74 75 76 77 78 79
AC_ARG_WITH([fuse], AS_HELP_STRING([--with-fuse]))
AS_IF([test "x$with_fuse" != "xno"], [
  PKG_CHECK_MODULES([fuse], [fuse3], [
    HAVE_FUSE=1
    AC_DEFINE(WITH_FUSE)
  ], [
80 81 82 83 84 85
    PKG_CHECK_MODULES([fuse2], [fuse], [
      HAVE_LEGACY_FUSE=1
      AC_DEFINE(WITH_LEGACY_FUSE)
    ], [
      AS_IF([test "x$with_fuse" = "xyes"], [AC_MSG_ERROR([fuse3 not found])])
    ])
Paweł Wegner committed
86 87 88
  ])
])
AM_CONDITIONAL([WITH_FUSE], [test "$HAVE_FUSE" -eq 1])
89
AM_CONDITIONAL([WITH_LEGACY_FUSE], [test "$HAVE_LEGACY_FUSE" -eq 1])
Paweł Wegner committed
90

91 92 93 94 95
AC_ARG_ENABLE([token-file], AC_HELP_STRING([--enable-token-file], [path to the json file with tokens]))
AS_IF([test "x$enable_token_file" != "x"], [
  AC_DEFINE_UNQUOTED(TOKEN_FILE, "${enable_token_file}")
])

96 97 98 99 100 101 102 103 104
case "${host_os}" in
  *mingw32*)
    SYS=mingw32
    ;;
  *)
    SYS=linux
    ;;
esac

105 106
AC_CONFIG_FILES([
  Makefile
Paweł Wegner committed
107
  src/libcloudstorage.pc
108 109
  src/Makefile
  test/Makefile
Paweł Wegner committed
110 111
  bin/Makefile
  bin/fuse/Makefile
112
  bin/cloudbrowser/Makefile
113
  examples/Makefile
114
  examples/commandlinebrowser/Makefile
115 116 117 118 119 120 121 122 123 124 125
])

SOCKET_LIBS=""
AS_IF([test "${SYS}" = "mingw32"], [
  SOCKET_LIBS="-lws2_32"
])
AC_SUBST(SOCKET_LIBS)

AC_ARG_WITH([examples], AS_HELP_STRING([--with-examples]))
AM_CONDITIONAL([EXAMPLES], [test "x$with_examples" = "xyes"])

126
HAVE_QT=0
127
HAVE_QTWEBVIEW=0
128
HAVE_THUMBNAILER=0
129
HAVE_VLC_QT=0
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165
HAVE_CLOUDBROWSER=0

AC_ARG_WITH([cloudbrowser], AS_HELP_STRING([--with-cloudbrowser]))
AS_IF([test "x$with_cloudbrowser" != "xno"], [
  AS_IF([test "$HAVE_CURL" -eq 1 -a "$HAVE_MICROHTTPD" -eq 1], [
    PKG_CHECK_MODULES([qt], [Qt5Core Qt5Gui Qt5Quick], [
      HAVE_QT=1
      HAVE_CLOUDBROWSER=1
      QT_PATH="$(eval $PKG_CONFIG --variable=exec_prefix Qt5Core)"
      QT_HOST_PATH="$(eval $PKG_CONFIG --variable=host_bins Qt5Core)"
      AC_PATH_PROGS(MOC, [moc-qt5 moc], moc, ["${QT_HOST_PATH}" "${QT_PATH}/bin"])
      AC_PATH_PROGS(RCC, [rcc-qt5 rcc], rcc, ["${QT_HOST_PATH}" "${QT_PATH}/bin"])
      AC_PATH_PROGS(UIC, [uic-qt5 uic], uic, ["${QT_HOST_PATH}" "${QT_PATH}/bin"])
      AC_DEFINE(WITH_QT)
    ], [
      HAVE_QT=0
      AS_IF([test "x$with_cloudbrowser" = "xyes"], [AC_MSG_ERROR([cloudbrowser requires qt])])
    ])
    PKG_CHECK_MODULES([qtwebview], [Qt5WebView], [
      HAVE_QTWEBVIEW=1
      AC_DEFINE(WITH_QTWEBVIEW)
    ], [HAVE_QTWEBVIEW=0])
    PKG_CHECK_MODULES([libffmpegthumbnailer], [libffmpegthumbnailer], [
      HAVE_THUMBNAILER=1
      AC_DEFINE(WITH_THUMBNAILER)
    ], [HAVE_THUMBNAILER=0])
    PKG_CHECK_MODULES([vlcqt], [libVLCQtQml], [
      HAVE_VLC_QT=1
      AC_DEFINE(WITH_VLC_QT)
    ], [HAVE_VLC_QT=0])
  ], [
    AS_IF([test "x$with_cloudbrowser" = "xyes"], [
      AS_IF([test "$HAVE_CURL" -eq 0], [AC_MSG_ERROR([cloudbrowser requires curl])])
      AS_IF([test "$HAVE_MICROHTTPD" -eq 0], [AC_MSG_ERROR([cloudbrowser requires microhttpd])])
    ])
  ])
166 167
])

168
AM_CONDITIONAL([WITH_QT], [test "$HAVE_QT" -eq 1])
169
AM_CONDITIONAL([WITH_QTWEBVIEW], [test "$HAVE_QTWEBVIEW" -eq 1])
170
AM_CONDITIONAL([WITH_THUMBNAILER], [test "$HAVE_THUMBNAILER" -eq 1])
171
AM_CONDITIONAL([WITH_VLC_QT], [test "$HAVE_VLC_QT" -eq 1])
172
AM_CONDITIONAL([WITH_CLOUDBROWSER], [test "$HAVE_CLOUDBROWSER" -eq 1])
Paweł Wegner committed
173

174
AC_OUTPUT