configure.ac 5.78 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

72 73 74 75
FILESYSTEM_LIBS=""
AC_ARG_WITH([filesystem], AS_HELP_STRING([--with-filesystem]))
AS_IF([test "x$with_filesystem" != "xno"], [
  AC_CHECK_HEADERS(boost/filesystem.hpp, [
76
    FILESYSTEM_LIBS="-lboost_system -lboost_filesystem"
77 78 79 80 81 82
  ], [
    AS_IF([test "x$with_filesystem" = "xyes"], [AC_MSG_ERROR([boost-filesystem not found])])
  ])
])
AC_SUBST(FILESYSTEM_LIBS)

Paweł Wegner committed
83
HAVE_FUSE=0
84
HAVE_LEGACY_FUSE=0
Paweł Wegner committed
85 86 87 88 89 90
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)
  ], [
91 92 93 94 95 96
    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
97 98 99
  ])
])
AM_CONDITIONAL([WITH_FUSE], [test "$HAVE_FUSE" -eq 1])
100
AM_CONDITIONAL([WITH_LEGACY_FUSE], [test "$HAVE_LEGACY_FUSE" -eq 1])
Paweł Wegner committed
101

102 103 104 105 106
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}")
])

107 108 109 110
case "${host_os}" in
  *mingw32*)
    SYS=mingw32
    ;;
111 112 113
  *android*)
    SYS=android
    ;;
114 115 116 117 118
  *)
    SYS=linux
    ;;
esac

119 120
AC_CONFIG_FILES([
  Makefile
Paweł Wegner committed
121
  src/libcloudstorage.pc
122 123
  src/Makefile
  test/Makefile
Paweł Wegner committed
124 125
  bin/Makefile
  bin/fuse/Makefile
126
  bin/cloudbrowser/Makefile
127
  examples/Makefile
128
  examples/commandlinebrowser/Makefile
129 130 131 132 133 134 135 136 137 138 139
])

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"])

140
HAVE_QT=0
141
HAVE_QTWEBVIEW=0
142
HAVE_QTANDROID=0
143
HAVE_THUMBNAILER=0
144
HAVE_VLC_QT=0
145 146 147 148 149 150 151 152 153 154 155 156 157
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"])
158 159 160 161 162 163 164 165 166 167 168 169 170
      AS_IF([test "${SYS}" = "android"], [
        PKG_CHECK_MODULES([qtandroid], [Qt5AndroidExtras], [
          HAVE_QTANDROID=1
          AC_DEFINE(WITH_QT)
        ], [
          HAVE_QT=0
          AS_IF([test "x$with_cloudbrowser" = "xyes"], [
            AC_MSG_ERROR([cloudbrowser requires qt android extras])
          ])
        ])
      ], [
        AC_DEFINE(WITH_QT)
      ])
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192
    ], [
      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])])
    ])
  ])
193 194
])

195
AM_CONDITIONAL([WITH_QT], [test "$HAVE_QT" -eq 1])
196
AM_CONDITIONAL([WITH_QTANDROID], [test "$HAVE_QTANDROID" -eq 1])
197
AM_CONDITIONAL([WITH_QTWEBVIEW], [test "$HAVE_QTWEBVIEW" -eq 1])
198
AM_CONDITIONAL([WITH_THUMBNAILER], [test "$HAVE_THUMBNAILER" -eq 1])
199
AM_CONDITIONAL([WITH_VLC_QT], [test "$HAVE_VLC_QT" -eq 1])
200
AM_CONDITIONAL([WITH_CLOUDBROWSER], [test "$HAVE_CLOUDBROWSER" -eq 1])
Paweł Wegner committed
201

202
AC_OUTPUT