dnl Process this file with autoconf to produce a configure script. AC_PREREQ(2.58) AC_INIT([OpenSync Python Module], 0.22, [], [libopensync-plugin-python]) AM_INIT_AUTOMAKE(foreign) AC_CONFIG_SRCDIR(src/python_module.c) AM_CONFIG_HEADER(config.h) AC_ISC_POSIX AC_PROG_CC AM_PROG_CC_STDC AC_HEADER_STDC AC_DISABLE_STATIC AC_PROG_LIBTOOL # Python SDK detection Code taken from Autoconf input script for Crystal Space # Copyright (C)2003 by Eric Sunshine #------------------------------------------------------------------------------ # Check if Python SDK is installed and which compiler and linker flags are # required to embed Python. Several techniques are used in an attempt to # determine the proper flags. First, an attempt it made to query Python's # "distutils.sysconfig" module. This should work for Python 2.x. If that # fails, Python's "sys" module is queried to find the path of the Python # standard library. Inside the library's "config" directory is a makefile # which can be parsed to glean the necessary flags. If the Python executable # is not available, try locating the Python directories and Makefile manually. # As a last resort, if the environment variables PYTHON_INC and PYTHON_LIB are # set, then use those values. #------------------------------------------------------------------------------ AC_CHECK_PROGS([PYTHON], [python]) AS_IF([test -n "$PYTHON"], [AC_CACHE_CHECK([for python distutils module], [os_cv_python_distutils], [AS_IF([AC_RUN_LOG([$PYTHON -c 'import distutils.sysconfig' 1>&2])], [os_cv_python_distutils=yes], [os_cv_python_distutils=no])])]) AC_CACHE_CHECK([for python SDK], [os_cv_python_sdk], [os_cv_python_sdk=no os_python_lib_dir='' os_python_makefile='' AS_IF([test -n "$PYTHON"], [# Python 2.x? AS_IF([test $os_cv_python_distutils = yes], [os_cv_python_base=`AC_RUN_LOG([$PYTHON -c \ 'import distutils.sysconfig ; import os.path ; \ print os.path.basename( \ distutils.sysconfig.get_python_lib(0,1))'])` os_cv_python_base_cflags=`AC_RUN_LOG([$PYTHON -c \ 'import distutils.sysconfig ; \ print "-I"+distutils.sysconfig.get_python_inc()'])` os_cv_python_base_lflags=`AC_RUN_LOG([$PYTHON -c \ 'import distutils.sysconfig ; import os.path ; \ print "-L"+distutils.sysconfig.get_python_lib(0,1)+" "+ \ "-L"+distutils.sysconfig.get_python_lib(0,1)+"/config"'])` os_cv_python_base_libs=`AC_RUN_LOG([$PYTHON -c \ 'import distutils.sysconfig ; \ print (distutils.sysconfig.get_config_var("LIBS") or "") + \ " " + (distutils.sysconfig.get_config_var("SYSLIBS") or "")'])` PYTHON_CFLAGS="$CFLAGS $os_cv_python_base_cflags" PYTHON_LDFLAGS="$LFLAGS $os_cv_python_base_lflags" PYTHON_LIBS="$LIBS $os_cv_python_base_libs -l$os_cv_python_base" AC_SUBST(PYTHON_CFLAGS) AC_SUBST(PYTHON_LDFLAGS) AC_SUBST(PYTHON_LIBS) os_cv_python_sdk=yes])])]) export PKG_CONFIG_PATH=$prefix/lib/pkgconfig:${PKG_CONFIG_PATH} PKG_CHECK_MODULES(OSYNC, [opensync-1.0 glib-2.0]) OPENSYNC_CONFIGDIR=$(pkg-config --variable=configdir opensync-1.0) OPENSYNC_PLUGINDIR=$(pkg-config --variable=plugindir opensync-1.0) OPENSYNC_FORMATSDIR=$(pkg-config --variable=formatsdir opensync-1.0) OPENSYNC_HEADERDIR=$(pkg-config --variable=headerdir opensync-1.0) AC_SUBST(OPENSYNC_CONFIGDIR) AC_SUBST(OPENSYNC_PLUGINDIR) AC_SUBST(OPENSYNC_FORMATSDIR) AC_SUBST(OPENSYNC_HEADERDIR) #FIXME: Set the python plugin path using a better method, instead of just # using libdir OPENSYNC_PYTHONPLG_DIR=${libdir}/opensync/python-plugins AC_SUBST(OPENSYNC_PYTHONPLG_DIR) AC_OUTPUT([Makefile])