1#                                               -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
4AC_PREREQ([2.61])
5AC_INIT([libsearpc], [3.1.0], [info@seafile.com])
6AC_CONFIG_SRCDIR([lib/searpc-server.c])
7AC_CONFIG_HEADERS([config.h])
8AC_CONFIG_MACRO_DIR([m4])
9
10
11AM_INIT_AUTOMAKE([1.9 foreign])
12#AC_MINGW32
13AC_CANONICAL_BUILD
14# Checks for programs.
15AC_PROG_CC
16LT_INIT
17
18# Checks for header files.
19#AC_CHECK_HEADERS([arpa/inet.h netinet/in.h stdint.h stdlib.h string.h sys/socket.h sys/time.h unistd.h])
20
21# Checks for typedefs, structures, and compiler characteristics.
22#AC_C_INLINE
23#AC_TYPE_SIZE_T
24#AC_TYPE_SSIZE_T
25#AC_TYPE_UINT16_T
26
27# Checks for library functions.
28#AC_CHECK_FUNCS([memset socket strerror strndup])
29
30# Options about demos and pysearpc
31
32# option: compile-demo
33# default: yes
34AC_ARG_ENABLE([compile-demo],
35[AS_HELP_STRING([--enable-compile-demo],
36[compile demo programs @<:@default: yes@:>@])],
37[compile_demo=${enableval}], [compile_demo=yes])
38
39AM_CONDITIONAL([COMPILE_DEMO], [test x${compile_demo} = xyes])
40
41AC_ARG_ENABLE(server-pkg,
42    AC_HELP_STRING([--enable-server-pkg], [enable static compile]),
43    [server_pkg=$enableval],[server_pkg="no"])
44
45dnl - check if the macro WIN32 is defined on this compiler.
46AC_MSG_CHECKING(for WIN32)
47
48if test "$build_os" = "mingw32" -o "$build_os" = "mingw64"; then
49  bwin32=true
50  LIB_WS32=-lws2_32
51  AC_SUBST(LIB_WS32)
52  AC_MSG_RESULT(compile in mingw)
53fi
54
55AM_CONDITIONAL([WIN32], [test "$MINGW32" = "yes"])
56AC_SUBST(WIN32)
57
58AC_MSG_CHECKING(for Mac)
59
60if test "$(uname -s)" = "Darwin"; then
61   bmac=yes
62fi
63
64if test x$bmac = "xyes"; then
65  server_pkg=no
66  AC_MSG_RESULT(compile in mac)
67fi
68
69AM_CONDITIONAL([MACOS], [test "$bmac" = "yes"])
70AC_SUBST(MACOS)
71
72AC_MSG_CHECKING(for FreeBSD)
73
74if test "$(uname -s)" = "FreeBSD"; then
75   bfbsd=yes
76fi
77
78if test x$bfbsd = "xyes"; then
79  server_pkg=no
80  AC_MSG_RESULT(compile in FreeBSD)
81fi
82
83AM_CONDITIONAL([FBSD], [test "$bfbsd" = "yes"])
84AC_SUBST(FBSD)
85
86# Checks for libraries.
87
88GLIB_REQUIRED=2.26.0
89
90# check and subst gobject
91PKG_CHECK_MODULES(GLIB, [gobject-2.0 >= $GLIB_REQUIRED])
92AC_SUBST(GLIB_CFLAGS)
93AC_SUBST(GLIB_LIBS)
94
95JANSSON_REQUIRED=2.2.1
96
97PKG_CHECK_MODULES(JANSSON, [jansson >= $JANSSON_REQUIRED])
98AC_SUBST(JANSSON_CFLAGS)
99AC_SUBST(JANSSON_LIBS)
100
101AM_PATH_PYTHON([2.4])
102if test "$bwin32" = true; then
103   if test x$PYTHON_DIR != x; then
104   # set pyexecdir to somewhere like /c/Python26/Lib/site-packages
105      pyexecdir=${PYTHON_DIR}/Lib/site-packages
106      pythondir=${pyexecdir}
107      pkgpyexecdir=${pyexecdir}/${PACKAGE}
108      pkgpythondir=${pythondir}/${PACKAGE}
109   fi
110fi
111
112AC_CONFIG_FILES([Makefile
113                 lib/Makefile
114                 demo/Makefile
115                 pysearpc/Makefile
116                 libsearpc.pc
117                 tests/Makefile])
118AC_OUTPUT
119
120
121