1
0
mirror of https://github.com/haiwen/libsearpc.git synced 2025-05-06 06:06:19 +00:00
libsearpc/configure.ac

146 lines
3.8 KiB
Plaintext
Raw Normal View History

2011-04-08 12:58:15 +00:00
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
2011-05-24 02:51:25 +00:00
AC_PREREQ([2.61])
2011-04-08 12:58:15 +00:00
AC_INIT([libsearpc], [1.0], [freeplant@gmail.com])
AC_CONFIG_SRCDIR([lib/searpc-server.c])
2011-04-08 12:58:15 +00:00
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
2011-05-18 03:06:01 +00:00
AM_INIT_AUTOMAKE([1.9 foreign])
2011-09-18 14:36:29 +00:00
AC_MINGW32
2011-04-08 12:58:15 +00:00
# Checks for programs.
AC_PROG_CC
AC_PROG_LIBTOOL
2011-04-08 12:58:15 +00:00
# Checks for header files.
AC_CHECK_HEADERS([arpa/inet.h netinet/in.h stdint.h stdlib.h string.h sys/socket.h sys/time.h unistd.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_INLINE
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_TYPE_UINT16_T
# Checks for library functions.
AC_CHECK_FUNCS([memset socket strerror strndup])
# Options about demos and pysearpc
# option: compile-demo
2011-04-09 10:40:55 +00:00
# default: yes
AC_ARG_ENABLE([compile-demo],
2011-04-09 10:40:55 +00:00
[AS_HELP_STRING([--enable-compile-demo],
[compile demo programs @<:@default: yes@:>@])],
[compile_demo=${enableval}], [compile_demo=yes])
AM_CONDITIONAL([COMPILE_DEMO], [test x${compile_demo} = xyes])
AC_ARG_ENABLE(server-pkg,
AC_HELP_STRING([--enable-server-pkg], [enable static compile]),
[server_pkg=$enableval],[server_pkg="no"])
2011-09-18 14:36:29 +00:00
dnl - check if the macro WIN32 is defined on this compiler.
AC_MSG_CHECKING(for WIN32)
if test "$MINGW32" = yes; then
bwin32=true
2011-12-01 10:42:17 +00:00
LIB_WS32=-lws2_32
2012-04-29 13:55:49 +00:00
LIB_PYTHON=-lpython26
2011-12-01 10:42:17 +00:00
AC_SUBST(LIB_WS32)
2012-04-29 13:55:49 +00:00
AC_SUBST(LIB_PYTHON)
2011-09-18 14:36:29 +00:00
AC_MSG_RESULT(compile in mingw32)
fi
2011-12-01 10:42:17 +00:00
AM_CONDITIONAL([WIN32], [test "$MINGW32" = "yes"])
AC_SUBST(WIN32)
2012-04-29 13:55:49 +00:00
AC_MSG_CHECKING(for Mac)
if test ${TERM_PROGRAM} = "Apple_Terminal" ; then
bmac=yes
2011-09-18 14:36:29 +00:00
fi
2012-04-29 13:55:49 +00:00
if test x$bmac = "xyes"; then
server_pkg=no
LIB_PYTHON=-lpython
AC_SUBST(LIB_PYTHON)
AC_MSG_RESULT(compile in mac)
fi
AM_CONDITIONAL([MACOS], [test "$bmac" = "yes"])
AC_SUBST(MACOS)
2011-09-18 14:36:29 +00:00
# option: compile-python
2011-04-09 10:40:55 +00:00
# default: no
AC_ARG_ENABLE([compile-python],
2011-04-09 10:40:55 +00:00
[AS_HELP_STRING([--enable-compile-python],
[compile pysearpc @<:@default: no@:>@])],
[compile_python=${enableval}], [compile_python=yes])
2011-04-09 10:40:55 +00:00
AM_CONDITIONAL([COMPILE_PYTHON], [test x${compile_python} = xyes])
# If we're building server release package, set the run-time path
# for the executables. So that the loader will lookup shared libs
# in 'lib' dir of the release package.
# Read "man ld.so" for description of $ORIGIN.
# Refer to http://blog.linuxgamepublishing.com/2009/02/08/our-new-way-to-meet-the-lgpl/
if test x${server_pkg} = xyes; then
SERVER_PKG_RPATH=-Wl,-R,\'\$\$ORIGIN/../../..\'
fi
AC_SUBST(SERVER_PKG_RPATH)
# Checks for libraries.
2011-04-08 12:58:15 +00:00
GLIB_REQUIRED=2.16.0
JSON_GLIB_REQUIRED=0.10.2
# check and subst glib
2011-04-08 12:58:15 +00:00
PKG_CHECK_MODULES(GLIB2, [glib-2.0 >= $GLIB_REQUIRED])
AC_SUBST(GLIB2_CFLAGS)
AC_SUBST(GLIB2_LIBS)
# check and subst gobject
2011-04-08 12:58:15 +00:00
PKG_CHECK_MODULES(GOBJECT, [gobject-2.0 >= $GLIB_REQUIRED])
AC_SUBST(GOBJECT_CFLAGS)
AC_SUBST(GOBJECT_LIBS)
# check and subst json-glib
2011-04-08 12:58:15 +00:00
PKG_CHECK_MODULES(JSON_GLIB, [json-glib-1.0 >= $JSON_GLIB_REQUIRED])
AC_SUBST(JSON_GLIB_CFLAGS)
AC_SUBST(JSON_GLIB_LIBS)
# conditinally check python and subst
if test x${compile_python} = xyes; then
2011-09-18 14:36:29 +00:00
AM_PATH_PYTHON([2.4])
2011-12-01 10:42:17 +00:00
if test "$bwin32" = true; then
if test x$PYTHON_DIR != x; then
# set pyexecdir to somewhere like /c/Python26/Lib/site-packages
pyexecdir=${PYTHON_DIR}/Lib/site-packages
pythondir=${pyexecdir}
pkgpyexecdir=${pyexecdir}/${PACKAGE}
pkgpythondir=${pythondir}/${PACKAGE}
2011-12-01 10:42:17 +00:00
fi
fi
2011-09-17 11:51:18 +00:00
AM_CHECK_PYTHON_HEADERS(,[AC_MSG_ERROR(could not find Python headers)])
if test "$bwin32" = true; then
pyexecdir=${PYTHON_DIR}/Lib/site-packages
pythondir=${pyexecdir}
pkgpyexecdir=${pyexecdir}/${PACKAGE}
pkgpythondir=${pythondir}/${PACKAGE}
fi
fi
2011-04-08 12:58:15 +00:00
AC_CONFIG_FILES([Makefile
lib/Makefile
demo/Makefile
2011-04-08 12:58:15 +00:00
pysearpc/Makefile
tests/Makefile])
AC_OUTPUT