1# ---------- 2# configure.ac 3# 4# Autoconf configuration file for Slony-I 5# 6# Copyright (c) 2003-2009, PostgreSQL Global Development Group 7# Author: Jan Wieck, Afilias USA INC. 8# 9# 10# Process this file with autoconf to produce a configure script. 11# ---------- 12m4_define([SLONREL_VERSION], esyscmd([echo "$Name: $" | \ 13 sed -e 's/\:\ REL_//' -e 's/\$//g' -e 's/_/./g' -e 's/\./\_/3' \ 14 -e 's/\ //g' -e s/\:/`echo 2.2.10`/ | tr -d '\n'])) 15 16m4_pattern_allow([^SLON_AC_]) 17 18 19AC_INIT(slony1,[SLONREL_VERSION]) 20AC_CONFIG_HEADERS(config.h) 21AC_CONFIG_AUX_DIR(config) 22AC_CONFIG_SRCDIR([src]) 23 24AC_CANONICAL_HOST 25 26template= 27AC_MSG_CHECKING([which template to use]) 28 29case $host_os in 30 aix*) template=aix ;; 31 beos*) template=beos ;; 32 bsdi*) template=bsdi ;; 33 cygwin*) template=win ;; 34 darwin*) template=darwin ;; 35 dgux*) template=dgux ;; 36 freebsd*) template=freebsd ;; 37 hpux*) template=hpux ;; 38 irix*) template=irix ;; 39 linux*|gnu*|k*bsd*-gnu) 40 template=linux ;; 41 mingw*) template=win32 ;; 42 netbsd*) template=netbsd ;; 43nextstep*) template=nextstep ;; 44 openbsd*) template=openbsd ;; 45 osf*) template=osf ;; 46 qnx*) template=qnx4 ;; 47 sco*) template=sco ;; 48 solaris*) template=solaris ;; 49 sunos*) template=sunos4 ;; 50 sysv4.2*) 51 case $host_vendor in 52 univel) template=univel ;; 53 esac ;; 54 sysv4*) template=svr4 ;; 55 sysv5*) template=unixware ;; 56 ultrix*) template=ultrix4 ;; 57esac 58 59if test x"$template" = x"" ; then 60 AC_MSG_ERROR([[ 61******************************************************************* 62Slony-I has apparently not been ported to your platform yet. 63To try a manual configuration, look into the src/template directory 64for a similar platform and use the '--with-template=' option. 65 66Please also contact <slony1-general@gborg.postgresql.org> to see about 67rectifying this. Include the above 'checking host system type...' 68line. 69*******************************************************************]]) 70fi 71AC_MSG_RESULT([$template]) 72 73# Checks for programs. 74#AC_PROG_CC 75SLON_AC_COMPILER() 76AC_PROG_LD 77PGAC_PATH_PERL 78AC_PATH_PROG(TAR, tar) 79 80 81# PGAC_PATH_FLEX 82# -------------- 83# Look for Flex, set the output variable FLEX to its path if found. 84# Reject versions before 2.5.31, as we need a reasonably non-buggy reentrant 85# scanner. We need at least 2.5.31 because we depend on 86# yyget_leng() to be defined since later some versions of flex switched 87# the definition of yyleng from an int to a size_t 88# Also find Flex if its installed under `lex', but do not 89# accept other Lex programs. 90 91AC_DEFUN([PGAC_PATH_FLEX], 92[AC_CACHE_CHECK([for flex], pgac_cv_path_flex, 93[# Let the user override the test 94if test -n "$FLEX"; then 95 pgac_cv_path_flex=$FLEX 96else 97 pgac_save_IFS=$IFS 98 IFS=$PATH_SEPARATOR 99 for pgac_dir in $PATH; do 100 IFS=$pgac_save_IFS 101 if test -z "$pgac_dir" || test x"$pgac_dir" = x"."; then 102 pgac_dir=`pwd` 103 fi 104 for pgac_prog in flex lex; do 105 pgac_candidate="$pgac_dir/$pgac_prog" 106 if test -f "$pgac_candidate" \ 107 && $pgac_candidate --version </dev/null >/dev/null 2>&1 108 then 109 echo '%%' > conftest.l 110 if $pgac_candidate -t conftest.l 2>/dev/null | grep FLEX_SCANNER >/dev/null 2>&1; then 111 pgac_flex_version=`$pgac_candidate --version 2>/dev/null` 112 if echo "$pgac_flex_version" | sed ['s/[.a-z]/ /g'] | awk '{ if (([$]1 = 2 && [$]2 == 5 && [$]3 >= 31) || ($[1] = 2 && $[2] > 5) || $[1] >= 3) exit 0; else exit 1;}' 113 then 114 pgac_cv_path_flex=$pgac_candidate 115 break 2 116 else 117 AC_MSG_WARN([ 118*** The installed version of Flex, $pgac_candidate, is too old to use with Slony-I. 119*** Flex version 2.5.31 or later is required, but this is $pgac_flex_version.]) 120 fi 121 fi 122 fi 123 done 124 done 125 rm -f conftest.l lex.yy.c 126 : ${pgac_cv_path_flex=no} 127fi 128])[]dnl AC_CACHE_CHECK 129 130if test x"$pgac_cv_path_flex" = x"no"; then 131 AC_MSG_WARN([ 132*** Without Flex you will not be able to build Slony-I from CVS nor 133*** change any of the scanner definition files. You can obtain Flex from 134*** a GNU mirror site. (If you are using the official distribution of 135*** Slony-I then you do not need to worry about this because the Flex 136*** output is pre-generated.)]) 137 138 LEX= 139else 140 LEX=$pgac_cv_path_flex 141 pgac_flex_version=`$FLEX --version 2>/dev/null` 142 AC_MSG_NOTICE([using $pgac_flex_version]) 143fi 144 145AC_SUBST(LEX) 146AC_SUBST(FLEXFLAGS) 147])# PGAC_PATH_FLEX 148 149 150AC_CHECK_PROGS(YACC, ['bison -y' , 'yacc']) 151AC_CHECK_PROGS(SED, ['sed']) 152 153AC_SUBST(LD) 154AC_SUBST(CC) 155AC_SUBST(GCC) 156AC_SUBST(YACC) 157AC_SUBST(YFLAGS) 158AC_SUBST(LEXFLAGS) 159AC_SUBST(YFLAGS) 160#AC_SUBST(SLONREL_VERSION) 161AC_SUBST(with_gnu_ld) 162AC_SUBST(PERL) 163AC_SUBST(SED) 164 165dnl Check whether to use the evil rpath or not 166SLON_AC_ARG_BOOL(enable, rpath, yes, 167 [ --disable-rpath do not embed shared library search path in executables]) 168AC_SUBST(enable_rpath) 169 170ACX_PTHREAD() 171 172##Portability checks 173AC_HEADER_STDC 174AC_CHECK_HEADERS([fcntl.h]) 175AC_CHECK_HEADERS([limits.h]) 176AC_CHECK_HEADERS([stddef.h]) 177AC_CHECK_HEADERS([sys/socket.h]) 178AC_CHECK_HEADERS([sys/time.h]) 179AC_CHECK_HEADERS([inttypes.h]) 180 181AC_CHECK_FUNCS([gettimeofday]) 182AC_CHECK_FUNCS([dup2]) 183AC_CHECK_FUNCS([alarm]) 184AC_CHECK_FUNCS([memset]) 185AC_CHECK_FUNCS([select]) 186AC_CHECK_FUNCS([strdup]) 187AC_CHECK_FUNCS([strerror]) 188AC_CHECK_FUNCS([strtol]) 189AC_CHECK_FUNCS([strtoul]) 190 191AC_CHECK_TYPES([int32_t, uint32_t, u_int32_t]) 192AC_CHECK_TYPES([int64_t, uint64_t, u_int64_t]) 193AC_CHECK_TYPES([size_t, ssize_t]) 194SLON_AC_FUNC_POSIX_SIGNALS() 195 196 197# ---- 198# Locate PostgreSQL paths 199# ---- 200 201AC_ARG_WITH(pgconfigdir, [ --with-pgconfigdir=<dir> Location of the PostgreSQL pg_config program. ]) 202AC_ARG_WITH(pgbindir, [ --with-pgbindir=<dir> Location of the PostgreSQL postmaster. ]) 203AC_ARG_WITH(pgincludedir, [ --with-pgincludedir=<dir> Location of the PostgreSQL headers. ]) 204AC_ARG_WITH(pgincludeserverdir, [ --with-pgincludeserverdir=<dir> Location of the PostgreSQL server headers. ]) 205AC_ARG_WITH(pglibdir, [ --with-pglibdir=<dir> Location of the PostgreSQL libs. ]) 206AC_ARG_WITH(pgpkglibdir, [ --with-pgpkglibdir=<dir> Location of the PostgreSQL pkglibs. E.g. plpgsql.so ]) 207AC_ARG_WITH(pgsharedir, [ --with-pgsharedir=<dir> Location of the PostgreSQL share dir. E.g. postgresql.conf.sample ]) 208AC_ARG_WITH(slonybindir, [ --with-slonybindir=<dir> Location to install slony binaries (slon,slonik,etc..) Default is $PREFIX/bin. ]) 209AC_ARG_WITH(perltools, [ --with-perltools=<dir> Location to install the perl management tools. Default $PREFIX/bin. ]) 210AC_ARG_WITH(perlsharedir, [ --with-perlsharedir=<dir> Location to install slon-tools.pm. Default $pglibdir. ]) 211AC_ARG_WITH(docs, [ --with-docs=<yes|no> Build the sgml documentation [default=no]]) 212AC_ARG_WITH(docdir, [ --with-docdir=<dir> Location to install all the documentation. Default is $PREFIX/doc. ]) 213AC_ARG_WITH(d2mdir, [ --with-d2mdir=<dir> Location of docbook2man-spec.pl (Manpages will be skipped if not specified)]) 214AC_ARG_WITH(mandir, [ --with-mandir=<dir> Location to install the manpages. Default is $PREFIX/man.]) 215AC_ARG_WITH(pgport, [ --with-pgport=<yes|no> Link with pgport [default=no]]) 216 217SLON_AC_ARG_BOOL(enable, engine, yes, 218 [ --disable-engine Don't build slony1-engine source. (Used when building documentation only)]) 219 220AC_SUBST(enable_engine) 221 222#Our current path 223SLONYPATH=`pwd` 224 225PGAC_PATH_FLEX() 226 227# ---- 228# PostgreSQL checks 229# ---- 230AC_MSG_CHECKING(if you have requested slony1-engine building) 231AC_MSG_RESULT($enable_engine) 232 233if test "$enable_engine" = "yes"; then 234 235ACX_LIBPQ() 236ACX_SLONYTOOLS() 237 238AC_SUBST(PG_VERSION_MAJOR, $PG_VERSION_MAJOR) 239AC_SUBST(PG_VERSION_MINOR, $PG_VERSION_MINOR) 240AC_SUBST(PG_VERSION, $PG_VERSION) 241 242AC_SUBST(PGINCLUDEDIR, $PG_INCLUDEDIR) 243AC_SUBST(PGINCLUDESERVERDIR, $PG_INCLUDESERVERDIR) 244AC_SUBST(PGLIBDIR, $PG_LIBDIR) 245AC_SUBST(PGPKGLIBDIR, $PG_PKGLIBDIR) 246AC_SUBST(PGSHAREDIR, $PG_SHAREDIR) 247AC_SUBST(PGBINDIR, $PG_BINDIR) 248AC_SUBST(TOOLSBIN, $TOOLSBIN) 249 250AC_SUBST(SLONYPATH) 251AC_SUBST(HOST_OS,$host_os) 252AC_SUBST(PORTNAME,$template) 253 254AC_SUBST(HAVE_PGPORT,$HAVE_PGPORT) 255AC_SUBST(HAVE_PGCOMMON,$HAVE_PGCOMMON) 256if test "${SLON_BINDIR}" = ""; then 257 if test ${prefix} = "NONE"; then 258 SLON_BINDIR="${PG_BINDIR}" 259 else 260 SLON_BINDIR="${prefix}/bin" 261 fi 262fi 263AC_SUBST(SLONBINDIR,$SLON_BINDIR) 264 265fi 266 267# ---- 268# Documentation checks 269# ---- 270SLON_AC_DOCS() 271ACX_SLONYDOCS() 272 273AC_SUBST(with_docs, $with_docs) 274 275AC_MSG_CHECKING(if you have requested documentation building) 276if test "$with_docs" = "yes"; then 277 278 AC_MSG_RESULT($with_docs) 279 280 # ---- 281 # Tools for building docs 282 # --- 283 284 SLON_AC_PROG_GROFF 285 SLON_AC_PROG_PS2PDF 286 SLON_AC_PROG_DJPEG 287 SLON_AC_PROG_PNMTOPS 288 SLON_AC_PROG_CONVERT 289 SLON_AC_PROG_PGAUTODOC 290 291 # 292 # Check for DocBook and tools 293 # 294 SLON_AC_PROG_NSGMLS 295 SLON_AC_PROG_SGMLSPL 296 SLON_AC_PROG_D2M 297 298 SLON_AC_PROG_JADE 299 SLON_AC_CHECK_DOCBOOK(4.2) 300 SLON_AC_PATH_DOCBOOK_STYLESHEETS 301 SLON_AC_PATH_COLLATEINDEX 302 303 AC_SUBST(docdir, $docdir) 304 AC_SUBST(mandir, $mandir) 305else 306 AC_MSG_RESULT(no) 307fi 308 309if test x"$with_perlsharedir" = x""; then 310 with_perlsharedir="$PG_LIBDIR" 311fi 312 313AC_SUBST(perlsharedir, $with_perlsharedir) 314AC_SUBST(CPPFLAGS_SERVER) 315AC_SUBST(CPPFLAGS_CLIENT) 316AC_CONFIG_FILES([ 317 Makefile.global GNUmakefile 318]) 319 320AC_OUTPUT([ 321 slony1.spec 322 Makefile.port:makefiles/Makefile.${template} 323]) 324