# Copyright (C) 2013 Equinox Software, Inc. # Mike Rylander # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. #--------------------------- # Init #--------------------------- export PATH=${PATH}:/usr/sbin AC_PREREQ(2.61) AC_INIT(ShareStuff, master, miker@esilibrary.com) AM_INIT_AUTOMAKE([ShareStuff], [master]) AC_REVISION($Revision: 0.1 $) AC_CONFIG_SRCDIR([configure.ac]) AC_SUBST(prefix) AC_SUBST([abs_top_builddir]) #----------------------------------- # Checks for programs. #----------------------------------- AC_PROG_LIBTOOL AC_PROG_CC AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_MAKE_SET AC_PROG_MKDIR_P AM_PROG_CC_C_O #----------------------------------- # Check for dependencies #----------------------------------- AC_PATH_PROG([OSRF_CONFIG], [osrf_config]) if test "x$OSRF_CONFIG" == "x"; then AC_MSG_ERROR([Could not find osrf_config. Ensure OpenSRF is installed and that the PATH environment variable includes the OpenSRF executables. For example: PATH=\$PATH:/openils/bin ./configure]) fi AC_ARG_WITH([opensrf-headers], [ --with-opensrf-headers=path location of the OpenSRF header files], [OPENSRF_HEADERS=${withval}], [OPENSRF_HEADERS=`$OSRF_CONFIG --includedir`]) AC_SUBST([OPENSRF_HEADERS]) # We need this for JavaScript AC_ARG_WITH([opensrf-libs], [ --with-opensrf-libs=path location of the OpenSRF libraries], [OPENSRF_LIBS=${withval}], [OPENSRF_LIBS=`$OSRF_CONFIG --libdir`]) AC_SUBST([OPENSRF_LIBS]) AC_ARG_WITH([tmp], [ --with-tmp=path location of the ShareStuff temporary directory (default is /tmp) ], [TMP=${withval}], [TMP=/tmp]) AC_SUBST([TMP]) AC_ARG_WITH([libxml2], [ --with-libxml2=path location of the libxml2 headers (default is /usr/include/libxml2)], [LIBXML2_HEADERS=${withval}], [LIBXML2_HEADERS=/usr/include/libxml2/]) AC_SUBST([LIBXML2_HEADERS]) AC_ARG_WITH([dbi], [ --with-dbi=path location of the libdbi driver libraries (default is /usr/local/lib/dbd)], [DBI_LIBS=${withval}], [DBI_LIBS=/usr/local/lib/dbd/]) # If the passed in value doesn't work, fall back to reasonable defaults # Distributions are starting to package a good version of libdbi / libdbd if ! test -d "$DBI_LIBS"; then for i in /usr/lib/dbd/ /usr/lib64/dbd /usr/local/lib/dbd/ ; do if test -d "$i"; then DBI_LIBS="$i" break fi done fi AC_SUBST([DBI_LIBS]) if test "x$openils_core" = "xtrue"; then AC_CHECK_PROG([MEMCACHED],memcached,yes,no) if test $MEMCACHED = "no"; then AC_MSG_ERROR([*** memcached not found, aborting]) fi AC_CHECK_PROG([ASPELL],aspell,yes,no) if test $ASPELL = "no"; then AC_MSG_ERROR([*** aspell not found, aborting]) fi AC_CHECK_PROG([CPAN],cpan,yes,no) if test $CPAN = "no"; then AC_MSG_ERROR([*** cpan not found, aborting]) fi AC_CHECK_PROG([YAZ],yaz-config,yes,no) if test $YAZ = "no"; then AC_MSG_ERROR([*** yaz not found, aborting]) fi AC_CHECK_PROG([PERL],perl,yes,no) if test $PERL = "no"; then AC_MSG_ERROR([*** perl not found, aborting]) fi #------------------------------------ # Checks for libraries. #------------------------------------ # Check for the rest of the libraries #check for dynamic linking functions AC_CHECK_LIB(dl,dlopen) #check for the libdbi library AC_CHECK_LIB(dbi,dbi_initialize) #to check for the availability and function of a particular #driver we need a runtime check (since the driver is loaded #dynamically). This example checks for the mysql driver AC_MSG_CHECKING([for libdbi pgsql driver (dynamic load)]) AC_RUN_IFELSE( [AC_LANG_PROGRAM(, [[dbi_initialize(0); return(dbi_conn_new("pgsql") ? 0 : 1);]])], [AC_MSG_RESULT("yes")], [AC_MSG_FAILURE("pgsql driver not installed?")]) AC_CHECK_LIB([expat], [main], [], AC_MSG_ERROR(*** ShareStuff requires libexpat)) AC_CHECK_LIB([ncurses], [main], [], AC_MSG_ERROR(*** ShareStuff requires libncurses)) # IF the OpenSRF libs are installed in a non-standard location, such as # /openils/lib, the compilation test will fail. Support that case. LDFLAGS="-L$OPENSRF_LIBS" AC_CHECK_LIB([opensrf], [osrfMessageFree], [], AC_MSG_ERROR(*** ShareStuff requires libopensrf)) AC_CHECK_LIB([readline], [main], [], AC_MSG_ERROR(*** ShareStuff requires libreadline)) AC_CHECK_LIB([xml2], [main], [], AC_MSG_ERROR(*** ShareStuff requires libxml2)) AC_CHECK_LIB([xslt], [main], [], AC_MSG_ERROR(*** ShareStuff requires libxslt)) AC_CHECK_LIB([pq], [main], [], AC_MSG_ERROR(*** ShareStuff requires libpq)) #------------------------------------ # Checks for header files. #------------------------------------ AC_HEADER_STDC AC_CHECK_HEADERS([fcntl.h langinfo.h locale.h stdlib.h string.h unistd.h]) #------------------------------------------------------------------- # Checks for typedefs, structures, and compiler characteristics. #------------------------------------------------------------------- AC_C_CONST AC_TYPE_SIZE_T AC_STRUCT_TM AC_HEADER_STDBOOL #------------------------------------------------------------------- # Checks for library functions. #------------------------------------------------------------------- AC_FUNC_STRFTIME AC_FUNC_STRTOD AC_CHECK_FUNCS([localtime_r memset nl_langinfo setlocale strcasecmp strchr strdup strerror strncasecmp]) #---------------------------- # Create Makefiles/Output #---------------------------- AC_CONFIG_FILES([src/c/Makefile]) fi AC_CONFIG_FILES([Makefile src/Makefile src/perl/Makefile ], [ ]) AC_OUTPUT #------------------------------------------------- # OUTPUT STUFF #------------------------------------------------- AC_MSG_RESULT([]) AC_MSG_RESULT([--------------------- Configuration options: -----------------------]) AC_MSG_RESULT([]) AC_MSG_RESULT([-------- Installation Directories --------]) AC_MSG_RESULT(Installation directory prefix: ${prefix}) AC_MSG_RESULT(Temporary directory: ${TMP}) AC_MSG_RESULT(libxml2 headers location: ${LIBXML2_HEADERS}) AC_MSG_RESULT(libdbi location: ${DBI_LIBS}) AC_MSG_RESULT(OpenSRF headers location: ${OPENSRF_HEADERS}) AC_MSG_RESULT(OpenSRF libraries location: ${OPENSRF_LIBS}) AC_MSG_RESULT([----------------------------------------------------------------------]) # vim:et:ts=4:sw=4: