configure 9.61 KB
Newer Older
mueller's avatar
mueller committed
1 2 3 4
#! /bin/sh
#
# $Id$
#
dimitri's avatar
dimitri committed
5
# Copyright (C) 1997-2000 by Dimitri van Heesch.
mueller's avatar
mueller committed
6 7 8 9 10 11 12
# 
# Permission to use, copy, modify, and distribute this software and its
# documentation under the terms of the GNU General Public License is hereby 
# granted. No representations are made about the suitability of this software 
# for any purpose. It is provided "as is" without express or implied warranty.
# See the GNU General Public License for more details.
# 
dimitri's avatar
dimitri committed
13 14
# Documents produced by Doxygen are derivative works derived from the
# input used in their production; they are not affected by this license.
mueller's avatar
mueller committed
15 16 17 18 19 20 21 22
# 
# shell script to configure doxygen

bin_dirs=`echo $PATH | sed -e "s/:/ /g"`

f_debug=NO
f_shared=YES
f_make=NO
23
f_dot=NO
mueller's avatar
mueller committed
24 25
f_perl=NO
f_plf_auto=NO
mueller's avatar
mueller committed
26
f_prefix=/usr
mueller's avatar
mueller committed
27
f_insttool=install
mueller's avatar
mueller committed
28
f_english=NO
dimitri's avatar
dimitri committed
29 30
f_configgen=NO
f_wizard=NO
mueller's avatar
mueller committed
31

mueller's avatar
mueller committed
32
while test -n "$1";  do
mueller's avatar
mueller committed
33
  case $1 in
mueller's avatar
mueller committed
34 35 36
    --prefix)
       shift; f_prefix=$1
       ;;
mueller's avatar
mueller committed
37 38 39 40 41 42 43 44 45 46 47 48
    --shared)
       f_shared=YES
       ;;
    --static)
       f_shared=NO
       ;;
    --release)
       f_debug=NO
       ;;
    --debug)
       f_debug=YES
       ;;
mueller's avatar
mueller committed
49 50 51
    --english-only)
       f_english=YES
       ;;
mueller's avatar
mueller committed
52 53 54 55 56 57
    --platform)
       shift; f_platform=$1
       ;;
    --make)
       shift; f_make=$1
       ;;
58 59 60
    --dot)
       shift; f_dot=$1
       ;;
mueller's avatar
mueller committed
61 62 63
    --perl)
       shift; f_perl=$1
       ;;
mueller's avatar
mueller committed
64 65 66
    --install)
       shift; f_insttool=$1
       ;;
dimitri's avatar
dimitri committed
67 68 69 70 71 72
    --with-configgen)
       f_configgen=YES
       ;;
    --with-doxywizard)
       f_wizard=YES
       ;;
mueller's avatar
mueller committed
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
    -h | -help | --help)
       f_help=y
       ;;
    *)
       echo $1: unknown argument
       f_help=y
       f_error=y
       ;;
  esac
  shift
done

if test "$f_help" = y; then
  cat <<EOF
Usage: $0 [--help] [--shared] [--static] [--release] [--debug] 
88
          [--perl name] [--make name] [--dot name] [--platform target] 
dimitri's avatar
dimitri committed
89 90
          [--prefix dir] [--install name] [--english-only] 
          [--with-configgen] [--with-doxywizard]
mueller's avatar
mueller committed
91

92
Options: 
mueller's avatar
mueller committed
93

mueller's avatar
mueller committed
94
  --help                Print this help
mueller's avatar
mueller committed
95

mueller's avatar
mueller committed
96 97
  --shared | --static   Build using shared or static linking
		        [default: shared]
mueller's avatar
mueller committed
98

mueller's avatar
mueller committed
99 100
  --release | --debug   Build for release or debug 
		        [default: release]
mueller's avatar
mueller committed
101

mueller's avatar
mueller committed
102 103
  --perl name           Use \`name' as the name of the perl interpreter 
		        [default: autodetect]
mueller's avatar
mueller committed
104

mueller's avatar
mueller committed
105 106
  --make name           Use \`name' as the name of the GNU make tool
		        [default: autodetect]
mueller's avatar
mueller committed
107

108 109 110 111
  --dot name            Use \`name' as the name of the dot tool that
                        is part of the Graphviz package.
                        [default: autodetect]

mueller's avatar
mueller committed
112 113
  --platform target     Do not detect platform but use \`target' instead.
                        See PLATFORMS for a list of possibilities
mueller's avatar
mueller committed
114

mueller's avatar
mueller committed
115 116
  --prefix dir          Installation prefix directory
                        [default: /usr]
mueller's avatar
mueller committed
117
  
mueller's avatar
mueller committed
118 119 120 121
  --install name        Use \`name' as the name of the GNU install tool
                        [default: install]

  --english-only        Include support for English only.
mueller's avatar
mueller committed
122

dimitri's avatar
dimitri committed
123 124 125 126 127 128 129
  --with-configgen      Build the configuration generator. This is only
                        useful for doxygen developers that want to add
                        new configuration options.

  --with-doxywizard     Build the GUI frontend for doxygen. This
                        requires Qt 2.x.x

mueller's avatar
mueller committed
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222
EOF
  test "$f_error" = y && exit 1
  exit 0;
fi

u_release=`(uname -r) 2>/dev/null` || u_release=unknown
u_system=`(uname -s) 2>/dev/null` || u_system=unknown

if test -z "$f_platform"; then
  f_platforms="`cat PLATFORMS`"
  
  case "$u_system:$u_release" in
    AIX*)
      f_platform=aix-xlc
      ;;
    dgux:*)
      f_platform=dgux-g++
      ;;
    FreeBSD:*)
      f_platform=freebsd-g++
      ;;
    GNU:*)
      f_platform=gnu-g++
      ;;
    HP-UX:*)
      f_platform=hpux-g++
      ;;
    IRIX64:*)
      f_platform=irix-64
      ;;
    IRIX:*)
      f_platform=irix-n32
      ;;
    Linux:*)
      f_platform=linux-g++
      ;;
    NetBSD:*)
      f_platform=netbsd-g++
      ;;
    OpenBSD:*)
      f_platform=openbsd-g++
      ;;
    OSF1:*)
      f_platform=osf1-g++
      ;;
    QNX:*)
      f_platform=qnx-g++
      ;;
    *:3.2)
      f_platform=sco-g++
      ;;
    SunOS:4*)
      f_platform=sunos-g++
      ;;
    SunOS:5*)
      f_platform=solaris-cc
      ;;
    ULTRIX:*)
      f_platform=ultrix-g++
      ;;
    UNIX_SV:4.2*)
      f_platform=unixware-g++
      ;;
    *)
    echo
    echo "Your platform was not recognised by this configure script"
    echo "Please use the -platform option to specify one of platforms"
    echo "in this list:"
    echo
    for p in $f_platforms
    do
      echo "    $0 $* -platform $p"
    done
    echo
    exit 2
  esac 
  echo "  Autodetected platform $f_platform... "
  f_plf_auto=YES
fi

if test "$f_plf_auto" = NO; then
  echo -n "  Checking for platform $f_platform... "
  if test '!' -d tmake/lib/$f_platform; then
    echo "not supported!" 
    echo
    exit 2
  fi
  echo "supported"
fi

#- check for qt --------------------------------------------------------------

echo -n "  Checking for Qt..."
mueller's avatar
mueller committed
223 224 225 226 227 228 229
if test -z "$QTDIR"; then
  echo "QTDIR not set!"
  echo
  echo "tmake requires the QTDIR environment variable to be set."
  echo "check your Qt installation!"
  exit 2
else
mueller's avatar
mueller committed
230
  if test ! -d "$QTDIR/lib"; then
mueller's avatar
mueller committed
231 232
    echo "QTDIR is set, but library directory does not exist!"
    exit 2
mueller's avatar
mueller committed
233
  fi
mueller's avatar
mueller committed
234
  if test ! -d "$QTDIR/include"; then
mueller's avatar
mueller committed
235 236
    echo "QTDIR is set, but include directory does not exist!"
    exit 2
mueller's avatar
mueller committed
237
  fi
mueller's avatar
mueller committed
238 239
  echo " headers $QTDIR/include,"
  echo "                     libraries $QTDIR/lib"  
mueller's avatar
mueller committed
240
fi
mueller's avatar
mueller committed
241
  
mueller's avatar
mueller committed
242 243
# - check for make ------------------------------------------------------------

mueller's avatar
mueller committed
244
echo -n "  Checking for GNU make tool... "
mueller's avatar
mueller committed
245
if test "$f_make" = NO; then
mueller's avatar
mueller committed
246
  make_names="gmake make"
mueller's avatar
mueller committed
247 248 249 250 251
  make_dirs="/usr/bin /usr/local/bin /bin /sbin $bin_dirs"
  make_prog=NO
  for i in $make_names; do
    for j in $make_dirs; do
      if test -x "$j/$i"; then
mueller's avatar
mueller committed
252 253 254 255
        if test -n "`$j/$i --version 2>/dev/null | grep GNU`"; then
          make_prog="$j/$i"
          break 2
        fi
mueller's avatar
mueller committed
256 257 258 259 260 261 262 263 264 265 266 267 268
      fi
    done
  done
  f_make="$make_prog" 
fi

if test "$f_make" = NO; then
  echo "not found!";
  echo
  exit 2
fi
echo "using $f_make"

269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289
# - check for dot ------------------------------------------------------------

echo -n "  Checking for dot... "
if test "$f_dot" = NO; then
  dot_dirs="$bin_dirs"
  dot_prog=NO
  for j in $dot_dirs; do
    if test -x "$j/dot"; then
      dot_prog="$j/dot"
      break 2
    fi
  done
  f_dot="$dot_prog" 
fi

if test "$f_dot" = NO; then
  echo "not found!";
else
  echo "using $f_dot"
fi

mueller's avatar
mueller committed
290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334
# - check for perl ------------------------------------------------------------

echo -n "  Checking for perl... "
if test "$f_perl" = NO; then
  perl_names="perl perl5"
  perl_dirs="/usr/bin /usr/local/bin /bin /sbin $bin_dirs"
  perl_prog=NO
  perl_found=NO
  for i in $perl_names; do
    for j in $perl_dirs; do
      if test -x "$j/$i"; then
        perl_found=YES
        if $j/$i -e 'require 5.000;' 2>/dev/null ; then
          perl_prog="$j/$i"
          break 2
        fi
      fi
    done
  done
  f_perl="$perl_prog" 
fi

if test "$f_perl" = NO; then
  if test "$perl_found" = YES; then
    echo "version is too old (5.000 or higher is required)."
  else
    echo "not found!";
  fi
  echo
  exit 2
fi
echo "using $f_perl";

# -----------------------------------------------------------------------------

test -f .makeconfig && rm .makeconfig
test -f .tmakeconfig && rm .tmakeconfig

cat > .makeconfig <<EOF
DOXYGEN   = $PWD
TMAKEPATH = $PWD/tmake/lib/$f_platform
TMAKE     = $PWD/tmake/bin/tmake
MAKE      = $f_make
PERL      = $f_perl
RM        = rm -f
dimitri's avatar
dimitri committed
335
CP        = cp
mueller's avatar
mueller committed
336
VERSION   = `cat VERSION`
mueller's avatar
mueller committed
337 338
INSTALL   = $f_prefix
INSTTOOL  = $f_insttool
mueller's avatar
mueller committed
339
DOXYDOCS  = ..
mueller's avatar
mueller committed
340 341

export TMAKEPATH
mueller's avatar
mueller committed
342 343
EOF

344 345 346 347 348 349
if test "$f_dot" != NO; then
  cat >> .makeconfig <<EOF
HAVE_DOT  = $f_dot
EOF
fi

mueller's avatar
mueller committed
350 351
touch .tmakeconfig
if test "$f_shared" = NO; then
dimitri's avatar
dimitri committed
352
  if test "$f_platform" = "osf1-cxx" -o "$f_platform" = "irix-n32"; then
mueller's avatar
mueller committed
353
  cat >> .tmakeconfig <<EOF
dimitri's avatar
dimitri committed
354
    TMAKE_LFLAGS = -non_shared
mueller's avatar
mueller committed
355
EOF
dimitri's avatar
dimitri committed
356
  elif test "$f_platform" = "solaris-cc"; then
dimitri's avatar
dimitri committed
357
  cat >> .tmakeconfig <<EOF
dimitri's avatar
dimitri committed
358
    TMAKE_LFLAGS = -Bstatic
dimitri's avatar
dimitri committed
359 360 361 362
EOF
  elif test "$f_platform" = "hpux-cc"; then
  cat >> .tmakeconfig <<EOF
    TMAKE_LFLAGS = -noshared
dimitri's avatar
dimitri committed
363
EOF
dimitri's avatar
dimitri committed
364 365 366 367 368
  else
  cat >> .tmakeconfig <<EOF
    TMAKE_LFLAGS = -static
EOF
  fi
mueller's avatar
mueller committed
369 370
fi

mueller's avatar
mueller committed
371
if test "$f_english" = YES; then
372
  cat >> .tmakeconfig <<EOF
mueller's avatar
mueller committed
373 374 375 376
TMAKE_CXXFLAGS = -DENGLISH_ONLY
EOF
fi

dimitri's avatar
dimitri committed
377
f_inmakefiles="Makefile.in src/Makefile.in examples/Makefile.in doc/Makefile.in addon/configgen/Makefile.in addon/doxywizard/Makefile.in addon/xmlread/Makefile.in"
dimitri's avatar
dimitri committed
378 379

for i in $f_inmakefiles ; do
mueller's avatar
mueller committed
380 381 382 383 384 385 386 387 388 389
     SRC=$i
     DST=`echo $i|sed 's%\(.*\).in$%\1%'`
     TIME=`date`
     cat > $DST <<EOF
#
# This file was generated from `basename $i` on $TIME
#

EOF
     cat .makeconfig $SRC >> $DST
dimitri's avatar
dimitri committed
390 391 392
     if test $i = Makefile.in; then
       echo "configgen:" >> $DST
       if test $f_configgen = YES; then
dimitri's avatar
dimitri committed
393
         echo "	\$(MAKE) -C addon/configgen" >> $DST
dimitri's avatar
dimitri committed
394 395 396 397 398 399 400 401 402 403
       fi
       echo "doxywizard:" >> $DST
       if test $f_wizard = YES; then
         echo "	\$(MAKE) -C addon/doxywizard" >> $DST
       fi
       echo "doxywizard_install:" >> $DST
       if test $f_wizard = YES; then
         echo "	\$(MAKE) -C addon/doxywizard install" >> $DST
       fi
     fi
mueller's avatar
mueller committed
404 405 406
     echo "  Created $DST from $SRC..."
done

dimitri's avatar
dimitri committed
407
f_inprofiles="src/doxygen.pro.in src/doxytag.pro.in src/doxysearch.pro.in addon/configgen/configgen.pro.in addon/doxywizard/doxywizard.pro.in addon/xmlread/xmlread.pro.in" 
dimitri's avatar
dimitri committed
408 409

for i in $f_inprofiles ; do
mueller's avatar
mueller committed
410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426
     SRC=$i
     DST=`echo $i|sed 's%\(.*\).in$%\1%'`
     TIME=`date`
     cat > $DST <<EOF
#
# This file was generated from `basename $i` on $TIME
#

EOF
     if test "$f_debug" = NO; then
       cat $SRC .tmakeconfig | sed -e "s/\$extraopts/release/g" >> $DST
     else
       cat $SRC .tmakeconfig | sed -e "s/\$extraopts/debug/g" >> $DST
     fi
     echo "  Created $DST from $SRC..."
done