1#!/bin/sh
2##############################################################################
3#               configure.gnu
4#
5# Wrapper to configure
6#
7# from Persistence of Vision(tm) Ray Tracer version 3.6.
8# Copyright 1991-2003 Persistence of Vision Team
9# Copyright 2003-2004 Persistence of Vision Raytracer Pty. Ltd.
10#---------------------------------------------------------------------------
11# NOTICE: This source code file is provided so that users may experiment
12# with enhancements to POV-Ray and to port the software to platforms other
13# than those supported by the POV-Ray developers. There are strict rules
14# regarding how you are permitted to use this file. These rules are contained
15# in the distribution and derivative versions licenses which should have been
16# provided with this file.
17#
18# These licences may be found online, linked from the end-user license
19# agreement that is located at http://www.povray.org/povlegal.html
20#---------------------------------------------------------------------------
21# This program is based on the popular DKB raytracer version 2.12.
22# DKBTrace was originally written by David K. Buck.
23# DKBTrace Ver 2.0-2.12 were written by David K. Buck & Aaron A. Collins.
24##############################################################################
25
26# configure.gnu for the source distribution of POV-Ray 3.6 for UNIX
27# Written by Nicolas Calimet <pov4grasp@free.fr>
28
29# get srcdir
30srcdir=`echo $* | grep srcdir | sed 's,.*srcdir=\([^[:space:]]*\).*,\1,g'`
31if test -z "$srcdir"; then
32  srcdir="."
33fi
34
35# process useful arguments (VAR=VALUE args are exported)
36args=
37for arg in $*; do
38  arg=`echo $arg | egrep "help|quiet|verbose|version|prefix|target|srcdir"`
39  arg=`echo $arg | sed 's,-*help=[^[:space:]]*,--help,g'`
40  args="$args $arg"
41done
42
43# GCOPTS and ENVOPTS will be used instead of CFLAGS.
44# Init OPTIMIZER to avoid defaults.
45CFLAGS=${CFLAGS:--O}
46GCOPTS="$CFLAGS $CPPFLAGS"
47ENVOPTS="$LDFLAGS"
48OPTIMIZER=
49
50### These tweaks were used for libtiff 3.5.7
51# Additional settings for Cygwin/MinGW (i.e. -mno-cygwin).
52# They are related to tif_jpeg.c which does some "wrong" assumptions.
53# - XMD_H prevents defining INT32 in jpeg/jmorecfg.h (called in jpeglib.h).
54# - The file says "The windows RPCNDR.H file defines boolean", which is
55#   apparently not the case in cygwin/mingw, resulting in undefined
56#   boolean typedef.  So I use a preprocessor #define for it.
57#if ! test -z "`echo $* | grep 'cygwin' | egrep 'out|no'`"; then
58#  ENVOPTS="$ENVOPTS -DXMD_H -Dboolean=int"
59#fi
60
61# zlib directory relative to tiff/libtiff/
62if test "$INCZ"; then
63  case $srcdir in
64    [\/]* | ?:[\/]* )  # absolute path
65    zlibdir=$srcdir/../zlib
66    ;;
67    *) # relative path
68    zlibdir=../$srcdir/../zlib
69    ;;
70  esac
71  ENVOPTS="-I$zlibdir $ENVOPTS"
72fi
73
74# jpeg directory relative to tiff/libtiff/
75if test "$INCJPEG"; then
76  case $srcdir in
77    [\/]* | ?:[\/]* )  # absolute path
78    jpegdir=$srcdir/../jpeg
79    ;;
80    *) # relative path
81    jpegdir=../$srcdir/../jpeg
82    ;;
83  esac
84  ENVOPTS="-I$jpegdir $ENVOPTS"
85fi
86
87# Variables must be set before calling configure (old-fashion configure).
88export GCOPTS ENVOPTS OPTIMIZER
89
90# run configure
91case "$args" in
92  *help*)
93  echo "Configuration of libtiff 3.6.1:"
94  echo ""
95  ;;
96
97  *)
98  args="--noninteractive --with-DSO=no $args"
99  echo "configure.gnu: configuring libtiff 3.6.1"
100  echo "configure.gnu: running $srcdir/configure $args"
101esac
102$srcdir/configure $args
103echo ""
104
105# ensure all files are read-writeable
106chmod -R u+rw *
107
108# post-process libtiff/Makefile
109if test -f libtiff/Makefile; then
110  echo "configure.gnu: editing libtiff/Makefile"
111
112  # libtiff/mkg3states requires port/libport.a on systems without getopt
113  if test -f port/Makefile; then
114    if test "`grep getopt port/Makefile`"; then
115      sed 's,\(-o mkg3states\),\1 ../port/libport.a,g' libtiff/Makefile > libtiff/Makefile.tmp
116      mv libtiff/Makefile.tmp libtiff/Makefile
117    fi
118  else
119    echo "all clean:" > port/Makefile
120  fi
121
122  # do not create tiffvers.h in srcdir
123  sed 's,^tiffvers\.h:.*,, ; s,${SRCDIR}/tiffvers\.h,tiffvers.h,g' libtiff/Makefile > libtiff/Makefile.tmp
124  mv libtiff/Makefile.tmp libtiff/Makefile
125fi
126echo ""
127