1 # Copyright (C) 2013 Equinox Software, Inc.
2 # Mike Rylander <miker@esilibrary.com>
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
15 #---------------------------
17 #---------------------------
19 export PATH=${PATH}:/usr/sbin
21 AC_INIT(ShareStuff, master, miker@esilibrary.com)
22 AM_INIT_AUTOMAKE([ShareStuff], [master])
23 AC_REVISION($Revision: 0.1 $)
24 AC_CONFIG_SRCDIR([configure.ac])
26 AC_SUBST([abs_top_builddir])
27 #-----------------------------------
28 # Checks for programs.
29 #-----------------------------------
40 #-----------------------------------
41 # Check for dependencies
42 #-----------------------------------
43 AC_PATH_PROG([OSRF_CONFIG], [osrf_config])
44 if test "x$OSRF_CONFIG" == "x"; then
45 AC_MSG_ERROR([Could not find osrf_config.
46 Ensure OpenSRF is installed and that the PATH environment variable includes
47 the OpenSRF executables. For example: PATH=\$PATH:/openils/bin ./configure])
50 AC_ARG_WITH([opensrf-headers],
51 [ --with-opensrf-headers=path location of the OpenSRF header files],
52 [OPENSRF_HEADERS=${withval}],
53 [OPENSRF_HEADERS=`$OSRF_CONFIG --includedir`])
54 AC_SUBST([OPENSRF_HEADERS])
56 # We need this for JavaScript
57 AC_ARG_WITH([opensrf-libs],
58 [ --with-opensrf-libs=path location of the OpenSRF libraries],
59 [OPENSRF_LIBS=${withval}],
60 [OPENSRF_LIBS=`$OSRF_CONFIG --libdir`])
61 AC_SUBST([OPENSRF_LIBS])
64 [ --with-tmp=path location of the ShareStuff temporary directory (default is /tmp) ],
69 AC_ARG_WITH([libxml2],
70 [ --with-libxml2=path location of the libxml2 headers (default is /usr/include/libxml2)],
71 [LIBXML2_HEADERS=${withval}],
72 [LIBXML2_HEADERS=/usr/include/libxml2/])
73 AC_SUBST([LIBXML2_HEADERS])
76 [ --with-dbi=path location of the libdbi driver libraries (default is /usr/local/lib/dbd)],
77 [DBI_LIBS=${withval}],
78 [DBI_LIBS=/usr/local/lib/dbd/])
80 # If the passed in value doesn't work, fall back to reasonable defaults
81 # Distributions are starting to package a good version of libdbi / libdbd
82 if ! test -d "$DBI_LIBS"; then
83 for i in /usr/lib/dbd/ /usr/lib64/dbd /usr/local/lib/dbd/ ; do
92 if test "x$openils_core" = "xtrue"; then
94 AC_CHECK_PROG([MEMCACHED],memcached,yes,no)
95 if test $MEMCACHED = "no"; then
96 AC_MSG_ERROR([*** memcached not found, aborting])
99 AC_CHECK_PROG([ASPELL],aspell,yes,no)
100 if test $ASPELL = "no"; then
101 AC_MSG_ERROR([*** aspell not found, aborting])
104 AC_CHECK_PROG([CPAN],cpan,yes,no)
105 if test $CPAN = "no"; then
106 AC_MSG_ERROR([*** cpan not found, aborting])
109 AC_CHECK_PROG([YAZ],yaz-config,yes,no)
110 if test $YAZ = "no"; then
111 AC_MSG_ERROR([*** yaz not found, aborting])
114 AC_CHECK_PROG([PERL],perl,yes,no)
115 if test $PERL = "no"; then
116 AC_MSG_ERROR([*** perl not found, aborting])
119 #------------------------------------
120 # Checks for libraries.
121 #------------------------------------
123 # Check for the rest of the libraries
125 #check for dynamic linking functions
126 AC_CHECK_LIB(dl,dlopen)
128 #check for the libdbi library
129 AC_CHECK_LIB(dbi,dbi_initialize)
131 #to check for the availability and function of a particular
132 #driver we need a runtime check (since the driver is loaded
133 #dynamically). This example checks for the mysql driver
134 AC_MSG_CHECKING([for libdbi pgsql driver (dynamic load)])
137 [[dbi_initialize(0); return(dbi_conn_new("pgsql") ? 0 : 1);]])],
138 [AC_MSG_RESULT("yes")],
139 [AC_MSG_FAILURE("pgsql driver not installed?")])
141 AC_CHECK_LIB([expat], [main], [], AC_MSG_ERROR(*** ShareStuff requires libexpat))
142 AC_CHECK_LIB([ncurses], [main], [], AC_MSG_ERROR(*** ShareStuff requires libncurses))
144 # IF the OpenSRF libs are installed in a non-standard location, such as
145 # /openils/lib, the compilation test will fail. Support that case.
146 LDFLAGS="-L$OPENSRF_LIBS"
148 AC_CHECK_LIB([opensrf], [osrfMessageFree], [], AC_MSG_ERROR(*** ShareStuff requires libopensrf))
149 AC_CHECK_LIB([readline], [main], [], AC_MSG_ERROR(*** ShareStuff requires libreadline))
150 AC_CHECK_LIB([xml2], [main], [], AC_MSG_ERROR(*** ShareStuff requires libxml2))
151 AC_CHECK_LIB([xslt], [main], [], AC_MSG_ERROR(*** ShareStuff requires libxslt))
152 AC_CHECK_LIB([pq], [main], [], AC_MSG_ERROR(*** ShareStuff requires libpq))
154 #------------------------------------
155 # Checks for header files.
156 #------------------------------------
159 AC_CHECK_HEADERS([fcntl.h langinfo.h locale.h stdlib.h string.h unistd.h])
161 #-------------------------------------------------------------------
162 # Checks for typedefs, structures, and compiler characteristics.
163 #-------------------------------------------------------------------
170 #-------------------------------------------------------------------
171 # Checks for library functions.
172 #-------------------------------------------------------------------
176 AC_CHECK_FUNCS([localtime_r memset nl_langinfo setlocale strcasecmp strchr strdup strerror strncasecmp])
178 #----------------------------
179 # Create Makefiles/Output
180 #----------------------------
182 AC_CONFIG_FILES([src/c/Makefile])
185 AC_CONFIG_FILES([Makefile
193 #-------------------------------------------------
195 #-------------------------------------------------
198 AC_MSG_RESULT([--------------------- Configuration options: -----------------------])
201 AC_MSG_RESULT([-------- Installation Directories --------])
202 AC_MSG_RESULT(Installation directory prefix: ${prefix})
203 AC_MSG_RESULT(Temporary directory: ${TMP})
204 AC_MSG_RESULT(libxml2 headers location: ${LIBXML2_HEADERS})
205 AC_MSG_RESULT(libdbi location: ${DBI_LIBS})
206 AC_MSG_RESULT(OpenSRF headers location: ${OPENSRF_HEADERS})
207 AC_MSG_RESULT(OpenSRF libraries location: ${OPENSRF_LIBS})
209 AC_MSG_RESULT([----------------------------------------------------------------------])