root/branches/1.3/configure.in

Revision 4013, 14.0 KB (checked in by pramsey, 3 years ago)

more search paths for XSL sheets in configure

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
  • Property svn:mime-type set to text/plain
Line 
1AC_INIT(README.postgis)
2AC_CONFIG_HEADER(config.h)
3
4dnl AC_ARG_ENABLE(autoconf, [  --enable-autoconf       really use autoconf],
5dnl     AC_MSG_RESULT(Using autoconf),
6dnl     AC_MSG_ERROR([
7dnl 
8dnl  Autoconf-based configuration is not widely tested.
9dnl  If you want to use it anyway specify --enable-autoconf.
10dnl  ])
11dnl  )
12
13dnl
14dnl Compilers
15dnl
16AC_PROG_CC
17AC_PROG_CXX
18AC_PROG_LN_S
19
20
21dnl
22dnl iconv support (might fail in case of non-default iconv installation)
23dnl
24AC_SUBST(USE_ICONV)
25AC_SUBST(ICONV_LDFLAGS)
26ICONV_LDFLAGS=
27USE_ICONV=1
28AC_ARG_WITH(iconv,
29[  --without-iconv         disable unicode support],
30        if test "$with_iconv" = "no"; then
31                USE_ICONV=0
32        fi
33)
34
35if test "$USE_ICONV" = 1; then
36        AC_CHECK_LIB(iconv, iconv_open,
37                USE_ICONV=1
38                ICONV_LDFLAGS=-liconv
39                ,
40                AC_CHECK_LIB(iconv, libiconv_open,
41                        USE_ICONV=1
42                        ICONV_LDFLAGS=-liconv
43                        ,
44                        AC_CHECK_LIB(c, iconv_open,
45                                USE_ICONV=1
46                                ,
47                                USE_ICONV=0
48                        )
49                )
50        )
51fi
52
53AC_CHECK_HEADERS(iconv.h)
54
55
56
57dnl
58dnl host operating system
59dnl
60AC_CANONICAL_HOST
61
62dnl
63dnl Search for pg_config and setup pgsql stuff
64dnl
65AC_SUBST(PGCONFIG)
66PGCONFIG=
67AC_ARG_WITH(pgsql,
68[  --with-pgsql[[=ARG]]      build for a specific pgsql version
69                          [[ARG=path to pg_config]]],
70        if test "$with_pgsql" != "no" -a "$with_pgsql" != "yes"; then
71                if test ! -f "$with_pgsql"; then
72                        AC_MSG_ERROR([Invalid argument to --with-pgsql]);
73                fi
74                PGCONFIG="$with_pgsql"
75        fi
76)
77if test -z "$PGCONFIG"; then
78        AC_PATH_PROG([PGCONFIG], [pg_config])
79fi
80if test -z "$PGCONFIG"; then
81        AC_MSG_ERROR([PostgreSQL is required by PostGIS]);
82fi
83AC_SUBST(PGFEINCLUDES)
84AC_SUBST(PGBEINCLUDES)
85AC_SUBST(PGFELIBS)
86AC_SUBST(PGBELIBS)
87AC_SUBST(PGBIN)
88AC_SUBST(PGTEMPLATE)
89AC_SUBST(LPATH)
90PGFEINCLUDES="-I"`${PGCONFIG} --includedir`
91PGFELIBS="-L"`${PGCONFIG} --libdir`" -lpq " #(1)# `${PGCONFIG} --libs 2> /dev/null`
92#(1)#
93# We don't really want to link to more libs then required, see:
94# http://postgis.refractions.net/pipermail/postgis-devel/2006-May/002124.html
95PGBELIBS="-L"`${PGCONFIG} --libdir`" -lpostgres"
96PGBEINCLUDES="-I"`${PGCONFIG} --includedir-server`
97PGBIN=`${PGCONFIG} --bindir`
98
99dnl
100dnl MingW requires use of pwd -W to give proper Windows (not MingW) paths
101dnl for in-place regression tests
102dnl
103case $host_os in
104        *mingw*)
105                PWDREGRESS="pwd -W"
106                ;;
107        *)
108                PWDREGRESS="pwd"
109                ;;
110esac
111AC_SUBST(PWDREGRESS)
112
113dnl
114dnl Test for GEOS
115dnl
116
117AC_SUBST(USE_GEOS)
118AC_SUBST(GEOS_DIR)
119AC_SUBST(GEOS_LDFLAGS)
120AC_SUBST(GEOS_VERNUM)
121USE_GEOS=0
122GEOS_DIR=
123GEOS_LDFLAGS=
124GEOS_VERNUM=10
125
126AC_PATH_PROG([GEOSCONFIG], [geos-config])
127if test -n "$GEOSCONFIG"; then
128        USE_GEOS=1
129fi
130
131AC_ARG_WITH(geos,
132[  --with-geos[[=ARG]]       enable spatial predicates and operators using GEOS
133                          [[ARG=path to geos-config]]],
134        if test "$with_geos" = "no"; then
135                USE_GEOS=0
136        else
137                if test "$with_geos" != "yes"; then
138                        if test ! -f "$with_geos"; then
139                    AC_MSG_ERROR([Invalid argument to --with-geos]);
140                        else
141                                GEOSCONFIG="$with_geos"
142                                USE_GEOS=1
143                AC_MSG_RESULT([Using specified geos-config file: $GEOSCONFIG])
144                        fi
145                fi
146        fi
147)
148
149if test $USE_GEOS -gt 0; then
150
151        GEOS_DIR=`$GEOSCONFIG --prefix`
152        GEOS_LDFLAGS=`$GEOSCONFIG --ldflags 2> /dev/null`
153
154        if test x"$GEOS_LDFLAGS" = "x"; then
155                # older geos-config versions did not
156                # support the --ldflags switch, we'll
157                # default to GEOS_DIR/lib in this case.
158                #
159                GEOS_LDFLAGS="-L${GEOS_DIR}/lib"
160        fi
161
162        GEOS_MAJOR=`$GEOSCONFIG --version | cut -d. -f1`
163        GEOS_MINOR=`$GEOSCONFIG --version | cut -d. -f2`
164        GEOS_VERNUM=`expr $GEOS_MAJOR "*" 10`
165        GEOS_VERNUM=`expr $GEOS_VERNUM "+" $GEOS_MINOR`
166
167        # GEOS >= 3.0.0 always has CAPI, however only GEOS >= 2.2.0 has CAPI support
168        # so abort if CAPI support is not available.
169        if test $GEOS_VERNUM -lt 22; then
170                AC_MSG_ERROR([PostGIS version >= 1.2.0 requires GEOS version >= 2.2.0])
171        fi
172
173fi
174
175AC_SUBST(USE_PROJ)
176AC_SUBST(PROJ_DIR)
177AC_SUBST(PROJ_LIBDIR)
178USE_PROJ=0
179PROJ_DIR=
180PROJ_LIBDIR=
181AC_PATH_PROG([PROJ], [proj])
182if test -n "$PROJ"; then
183        USE_PROJ=1
184        PROJ_DIR=`dirname ${PROJ}`/..
185        owd=`pwd`; cd ${PROJ_DIR}; PROJ_DIR=`pwd`; cd $owd;
186fi
187AC_ARG_WITH(proj,
188        [  --with-proj[[=DIR]]       enable reprojection support],
189        if test "$with_proj" = "no"; then
190                USE_PROJ=0
191        else
192                USE_PROJ=1
193                if test "$with_proj" != "yes"; then
194                        PROJ_DIR=$with_proj
195                fi
196        fi
197)
198if test $USE_PROJ -gt 0; then
199        if test ! -f $PROJ_DIR/include/projects.h; then
200                AC_MSG_ERROR([Can't find proj dir.]);
201        fi
202        PROJ_LIBDIR=${PROJ_DIR}/lib
203fi
204
205AC_ARG_WITH(proj-libdir,
206[  --with-proj-libdir=PATH path to PROJ4 libdir],
207[
208case "$with_proj_libdir" in
209        no|yes)
210                AC_MSG_ERROR([Invalid argument to --with-proj-libdir])
211                ;;
212        *)
213                PROJ_LIBDIR=${with_proj_libdir}
214                ;;
215esac
216], with_proj_libdir=no)
217
218AC_SUBST(USE_JTS)
219AC_SUBST(JTS_INCLUDES)
220AC_SUBST(JTS_LIBDIR)
221USE_JTS=0
222JTS_INCLUDES=
223JTS_INCLUDES=
224AC_ARG_WITH(jts,
225[  --with-jts[[=ARG]]        use JTS for spatial predicates and operators
226                          [[ARG=path to jts-config]]],
227        if test "$with_jts" != "no"; then
228                USE_JTS=1
229                if test "$with_jts" != "yes"; then
230                        if test ! -f "$with_jts"; then
231        AC_MSG_ERROR([Invalid argument to --with-jts]);
232                        else
233                                JTSCONFIG=$with_jts
234                        fi
235                fi
236        fi
237)
238if test $USE_JTS -gt 0; then
239        if test -z "$JTSCONFIG"; then
240                AC_PATH_PROG([JTSCONFIG], [jts-config])
241                if test -z "$JTSCONFIG"; then
242                        AC_MSG_ERROR([Can't find jts-config]);
243                fi
244        fi
245        JTS_INCLUDES=`$JTSCONFIG --includedir`
246        JTS_LIBDIR=`$JTSCONFIG --libdir`
247fi
248
249dnl
250dnl Search flex and yacc
251dnl
252AC_SUBST(FLEX)
253AC_PATH_PROG([FLEX], [flex])
254if test -z "$FLEX"; then
255        AC_MSG_ERROR(Can't find 'flex');
256fi
257
258AC_SUBST(DLLWRAP)
259AC_PATH_PROG([DLLWRAP], [dllwrap])
260AC_SUBST(DLLTOOL)
261AC_PATH_PROG([DLLTOOL], [dlltool])
262
263dnl AC_SUBST(YACC)
264dnl AC_PATH_PROG([YACC], [yacc])
265AC_PROG_YACC
266if test -z "$YACC"; then
267        AC_MSG_ERROR(Can't find 'yacc');
268fi
269
270dnl
271dnl Find 'install'
272dnl
273dnl AC_PATH_PROG([INSTALL], [install])
274dnl if test -z "$INSTALL"; then
275dnl     AC_MSG_ERROR(Can't find 'install');
276dnl fi
277AC_SUBST(INSTALL)
278INSTALL=`pwd`"/install-sh"
279
280dnl
281dnl Search perl
282dnl
283AC_SUBST(PERL)
284AC_PATH_PROG([PERL], [perl])
285if test -z "$PERL"; then
286        AC_MSG_ERROR(Can't find 'perl');
287fi
288
289AC_SUBST(docdir)
290docdir='${prefix}/share/doc'
291AC_ARG_WITH(docdir,
292[  --with-docdir=DIR       install the documentation in DIR [[PREFIX/share/doc]]],
293        if test "$with_docdir" = "yes"; then
294                AC_MSG_ERROR([option --with-docdir requires an argument])
295        fi
296        if test "$with_docdir" != "no"; then
297                docdir="$with_docdir"
298        fi
299)
300
301dnl
302dnl Find 'html/docbook.xsl'
303dnl
304AC_SUBST(XSLBASE)
305XSLBASE=
306AC_ARG_WITH(xsl,
307[  --with-xsl=DIR      Specify the DIR containing html/docbook.xsl stylesheet],
308        if test "$with_xsl" = yes; then
309                AC_MSG_ERROR([option --with-xsl requires an argument])
310        fi
311        if test "$with_xsl" != "no"; then
312                xsl="$with_xsl"
313        fi
314        ,
315        SEARCHPATH="
316                /usr/share/sgml/docbook/xsl-stylesheets
317                /usr/share/xml/docbook/stylesheet/nwalsh
318                /usr/share/sgml/docbook/stylesheet/xsl/nwalsh
319                /opt/local/share/xsl/docbook-xsl
320                /usr/local/share/xsl/docbook-xsl
321                /usr/share/xsl/docbook-xsl
322                "
323        for p in ${SEARCHPATH}; do
324                if test -r "${p}"/html/docbook.xsl; then
325                        xsl="${p}"
326                        break
327                fi
328        done
329)
330XSLBASE="${xsl}"
331
332dnl
333dnl Search for other binaries needed to build docs
334dnl
335AC_PATH_PROG([XSLTPROC], [xsltproc])
336AC_PATH_PROG([PDFXMLTEX], [pdfxmltex])
337AC_PATH_PROG([DB2PDF], [db2pdf])
338AC_PATH_PROG([JW], [jw])
339AC_SUBST(XSLTPROC)
340AC_SUBST(PDFXMLTEX)
341AC_SUBST(JW)
342
343DOC_RULE=requirements_not_met
344if test -n "${XSLBASE}"; then
345        if test -n "${XSLTPROC}"; then
346                DOC_RULE=html/postgis.html
347        else
348                if test -n "${JW}"; then
349                        DOC_RULE=jw
350                fi
351        fi
352fi
353AC_SUBST(DOC_RULE)
354
355
356if test $USE_JTS -gt 0; then
357dnl     AC_MSG_RESULT([ GEOS disabled, using JTS.])
358        USE_GEOS=0
359        AC_DEFINE(USE_JTS)
360fi
361
362if test $USE_GEOS -gt 0; then
363        AC_DEFINE(USE_GEOS)
364fi
365
366#
367# Extract PostgreSQL paths from pg_config
368##
369
370#
371# Prefix (pg_prefix)
372#
373pg_prefix=/usr/local/pgsql
374pg_eprefix=
375pg_docdir=
376pg_datadir=
377pg_mandir=
378pg_bindir="`${PGCONFIG} --bindir`"
379pg_pkglibdir="`${PGCONFIG} --pkglibdir`"
380for v in `${PGCONFIG} --configure`; do
381        strip=`echo $v | sed "s/'//g"`
382        var=`echo "$strip" | cut -d= -f1`
383        if test "$var" = "--prefix"; then
384                pg_prefix=`echo "$strip" | cut -d= -f2`
385        elif test "$var" = "--exec-prefix"; then
386                pg_eprefix=`echo "$strip" | cut -d= -f2`
387        elif test "$var" = "--docdir"; then
388                pg_docdir=`echo "$strip" | cut -d= -f2`
389        elif test "$var" = "--with-docdir"; then
390                pg_docdir=`echo "$strip" | cut -d= -f2`
391        elif test "$var" = "--datadir"; then
392                pg_datadir=`echo "$strip" | cut -d= -f2`
393        elif test "$var" = "--mandir"; then
394                pg_mandir=`echo "$strip" | cut -d= -f2`
395        elif test "$var" = "--with-template"; then
396                PGTEMPLATE=`echo "$strip" | cut -d= -f2`
397        fi
398done
399#
400# We set these defaults after scan of
401# pg_config --configure to safely expand pg_prefix
402# We need expansion for the 'postgresq' path component
403# addition below (default paths take from pg_config)
404#
405if test -z "$pg_eprefix"; then pg_eprefix=${pg_prefix}; fi
406if test -z "$pg_docdir"; then pg_docdir=${pg_prefix}'/doc'; fi
407if test -z "$pg_datadir"; then pg_datadir=${pg_prefix}'/share'; fi
408if test -z "$pg_mandir"; then pg_mandir=${pg_prefix}'/man'; fi
409
410# Use old layout by default
411use_new_layout=0
412
413if test "$prefix" != 'NONE'; then
414        use_new_layout=1
415fi
416
417if test "${use_new_layout}" = "1"; then
418        LPATH=$libdir
419else
420
421        #
422        # Use old layout: everything under PGSQL paths
423        # Note: still allow override by user, this is
424        #       done checking each variable against its
425        #       default value, if it has a different
426        #       value do not use PGSQL versions
427        #
428
429        if test "$prefix" = 'NONE'; then
430                prefix=${pg_prefix}
431        fi
432
433        if test "$docdir" = '${prefix}/share/doc'; then
434                docdir=${pg_docdir}
435                #
436                # If docdir contains no 'pgsql' or 'postgres'
437                # add the suffix. This is derived from
438                # PGSQL_SRC/src/Makefile.global
439                #
440                if expr "${docdir}" : ".*/pgsql" > /dev/null ; then :; else
441                if expr "${docdir}" : ".*/postgres" > /dev/null ; then :; else
442                        docdir=${docdir}"/postgresql"
443                fi
444                fi
445                # Add the "contrib" part
446                docdir=${docdir}"/contrib"
447        fi
448
449        if test "$datadir" = '${prefix}/share'; then
450                datadir=${pg_datadir}
451                #
452                # If datadir contains no 'pgsql' or 'postgres'
453                # add the suffix. This is derived from
454                # PGSQL_SRC/src/Makefile.global
455                #
456                if expr "${datadir}" : ".*/pgsql" > /dev/null ; then :; else
457                if expr "${datadir}" : ".*/postgres" > /dev/null ; then :; else
458                        datadir=${datadir}"/postgresql"
459                fi
460                fi
461                # Add the "contrib" part
462                datadir=${datadir}"/contrib"
463        fi
464
465        if test "$mandir" = '${prefix}/man'; then
466                mandir=${pg_mandir}
467        fi
468
469        if test "$bindir" = '${exec_prefix}/bin'; then
470                bindir=${pg_bindir}
471        fi
472
473        if test "$libdir" = '${exec_prefix}/lib'; then
474                libdir=${pg_pkglibdir}
475                LPATH='\$$libdir'
476        else
477                LPATH=$libdir
478        fi
479fi
480
481# --with-template parsing is done in the single
482# pg_config --configure scan above
483AC_MSG_CHECKING([which template to use])
484template=$PGTEMPLATE
485
486case $host_os in
487     aix*) template=aix ;;
488    beos*) template=beos ;;
489    bsdi*) template=bsdi ;;
490  cygwin*) template=cygwin ;;
491  darwin*) template=darwin ;;
492    dgux*) template=dgux ;;
493 freebsd*) template=freebsd ;;
494    hpux*) template=hpux ;;
495    irix*) template=irix ;;
496 linux*|gnu*|k*bsd*-gnu)
497           template=linux ;;
498   mingw*) template=win32 ;;
499  netbsd*) template=netbsd ;;
500nextstep*) template=nextstep ;;
501 openbsd*) template=openbsd ;;
502     osf*) template=osf ;;
503     qnx*) template=qnx4 ;;
504     sco*) template=sco ;;
505 solaris*) template=solaris ;;
506   sunos*) template=sunos4 ;;
507 sysv4.2*)
508        case $host_vendor in
509          univel) template=univel ;;
510        esac ;;
511   sysv4*) template=svr4 ;;
512   sysv5*) template=unixware ;;
513  ultrix*) template=ultrix4 ;;
514esac
515
516  if test x"$template" = x"" ; then
517    AC_MSG_ERROR([[
518*******************************************************************
519PostgreSQL has apparently not been ported to your platform yet.
520To try a manual configuration, look into the src/template directory
521for a similar platform and use the '--with-template=' option.
522
523Please also contact <pgsql-ports@postgresql.org> to see about
524rectifying this.  Include the above 'checking host system type...'
525line.
526*******************************************************************
527]])
528  fi
529
530AC_MSG_RESULT([$template])
531
532PORTNAME=$template
533AC_SUBST(PORTNAME)
534
535
536#
537# OS-specific settings
538#
539AC_SUBST(DLSUFFIX)
540AC_SUBST(DLFLAGS)
541AC_SUBST(EXE)
542AC_SUBST(HOST_OS)
543
544# host_os is defined by AC_CANONICAL_HOST
545HOST_OS=$host_os
546DLSUFFIX=.so
547DLFLAGS=-shared
548EXE=
549case $host_os in
550        *mingw*)
551                PGBEINCLUDES="$PGBEINCLUDES $PGBEINCLUDES/port/win32"
552                DLSUFFIX=.dll
553                DLFLAGS='${PGBELIBS}'
554                EXE=.exe
555                ;;
556        *darwin*)
557                DLFLAGS="-no-cpp-precomp -flat_namespace -undefined suppress -multiply_defined suppress"
558                ;;
559esac
560
561# Assume system is ELF if it predefines __ELF__ as 1,
562# otherwise believe host_os based default.
563case $host_os in
564    freebsd1*|freebsd2*) elf=no;;
565    freebsd3*|freebsd4*) elf=yes;;
566esac
567
568AC_EGREP_CPP(yes,
569[#if __ELF__
570  yes
571#endif
572],
573[ELF_SYS=true],
574[if test "X$elf" = "Xyes" ; then
575  ELF_SYS=true
576else
577  ELF_SYS=
578fi])
579AC_SUBST(ELF_SYS)
580
581
582
583AC_OUTPUT(Makefile.config)
584
585AC_MSG_RESULT([ ])
586AC_MSG_RESULT([ SUMMARY])
587AC_MSG_RESULT([ -------------------------------------------------------])
588AC_MSG_RESULT([ ])
589AC_MSG_RESULT([ HOST_OS: $host_os])
590AC_MSG_RESULT([ ])
591AC_MSG_RESULT([   PGSQL: $PGCONFIG])
592
593if test $USE_JTS -gt 0; then
594        AC_MSG_RESULT([     JTS: includedir=$JTS_INCLUDES libdir=$JTS_LIBDIR])
595fi
596
597# GEOS CAPI information
598if test $USE_GEOS -gt 0; then
599        AC_MSG_RESULT([    GEOS: $GEOSCONFIG (with C-API)])
600    AC_MSG_RESULT([          (ldflags: $GEOS_LDFLAGS)])
601fi
602
603# PROJ.4 information
604if test $USE_PROJ -gt 0; then
605        AC_MSG_RESULT([    PROJ: prefix=$PROJ_DIR libdir=$PROJ_LIBDIR])
606fi
607
608AC_MSG_RESULT([   ICONV: $USE_ICONV $ICONV_LDFLAGS])
609dnl AC_MSG_RESULT([  FLEX:  path=$FLEX])
610dnl AC_MSG_RESULT([  YACC:  path=$YACC])
611
612AC_MSG_RESULT([  ])
613AC_MSG_RESULT([ PORTNAME: $PORTNAME])
614AC_MSG_RESULT([   PREFIX: $prefix])
615AC_MSG_RESULT([  EPREFIX: $exec_prefix])
616AC_MSG_RESULT([      DOC: $docdir])
617AC_MSG_RESULT([     DATA: $datadir])
618AC_MSG_RESULT([      MAN: $mandir])
619AC_MSG_RESULT([      BIN: $bindir])
620if test "$MODULE_INSTALLDIR" = "$LPATH"; then
621        AC_MSG_RESULT([      EXT: $libdir])
622else
623        AC_MSG_RESULT([      EXT: $libdir ($LPATH)])
624fi
625
626AC_MSG_RESULT([ -------------------------------------------------------])
627AC_MSG_RESULT([ ])
Note: See TracBrowser for help on using the browser.