configure 12.9 KB
Newer Older
1 2 3 4
#! /bin/sh
#
# $Id$
#
5
# Copyright (C) 1997-2001 by Dimitri van Heesch.
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 van Heesch's avatar
Dimitri van Heesch 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.
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
24 25
f_perl=NO
f_plf_auto=NO
26
f_prefix=/usr
27
f_insttool=NO
28
f_english=NO
29
f_wizard=NO
30
f_langs=nl,se,cz,fr,it,de,jp,je,es,fi,ru,hr,pl,pt,hu,kr,ke,ro,si,cn,no,br,dk,sk,ua,gr,tw,sr,ca
31

32
while test -n "$1";  do
33
  case $1 in
Dimitri van Heesch's avatar
Dimitri van Heesch committed
34
    --prefix | -prefix)
35 36
       shift; f_prefix=$1
       ;;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
37 38 39 40
    --docdir | -docdir)
       shift; f_docdir=$1/doxygen
       ;;
    --shared | -shared)
41 42
       f_shared=YES
       ;;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
43
    --static | -static)
44 45
       f_shared=NO
       ;;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
46
    --release | -release)
47 48
       f_debug=NO
       ;;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
49
    --debug | -debug)
50 51
       f_debug=YES
       ;;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
52
    --english-only | -english-only)
53 54
       f_english=YES
       ;;
55 56 57
    --enable-langs | -enable-langs)
       shift; f_langs=$1
       ;;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
58
    --platform | -platform)
59 60
       shift; f_platform=$1
       ;;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
61
    --make | -make)
62 63
       shift; f_make=$1
       ;;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
64
    --dot | -dot)
65 66
       shift; f_dot=$1
       ;;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
67
    --perl | -perl)
68 69
       shift; f_perl=$1
       ;;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
70
    --install | -install)
71 72
       shift; f_insttool=$1
       ;;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
73
    --with-doxywizard | -with-doxywizard)
74 75
       f_wizard=YES
       ;;
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
    -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] 
91
          [--perl name] [--make name] [--dot name] [--platform target] 
Dimitri van Heesch's avatar
Dimitri van Heesch committed
92
          [--prefix dir] [--docdir dir] [--install name] [--english-only] 
93
          [----enable-langs list] [--with-doxywizard] 
94

95
Options: 
96

97 98 99 100 101 102 103 104 105
  --help                Print this help
  --shared | --static   Build using shared or static linking
		        [default: shared]
  --release | --debug   Build for release or debug 
		        [default: release]
  --perl name           Use \`name' as the name of the perl interpreter 
		        [default: autodetect]
  --make name           Use \`name' as the name of the GNU make tool
		        [default: autodetect]
106 107 108
  --dot name            Use \`name' as the name of the dot tool that
                        is part of the Graphviz package.
                        [default: autodetect]
109 110
  --platform target     Do not detect platform but use \`target' instead.
                        See PLATFORMS for a list of possibilities
Dimitri van Heesch's avatar
Dimitri van Heesch committed
111 112
  --prefix dir          Installation prefix directory (doxygen will be
                        put in PREFIX/bin/doxygen)
113
                        [default: /usr]
Dimitri van Heesch's avatar
Dimitri van Heesch committed
114 115
  --docdir dir          Documentation is installed in DOCDIR/doxygen/
                        [default: PREFIX/share/doc/packages]
116
  --install name        Use \`name' as the name of the GNU install tool
117
                        [default: autodetect]
118
  --english-only        Include support for English only.
119 120
  --enable-langs list 	Include support for output languages listed in list.
  			[default: $f_langs]
121 122 123
  --with-doxywizard     Build the GUI frontend for doxygen. This
                        requires Qt 2.x.x

124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141
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++
      ;;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
142 143 144
    Darwin:*)
      f_platform=macosx-c++
      ;;
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
    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++
      ;;
190 191 192
    Cygwin:*)
      f_platform=win32-g++
      ;;
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209
    *)
    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

Dimitri van Heesch's avatar
Dimitri van Heesch committed
210 211 212 213
if test -z "$f_docdir"; then
  f_docdir=$f_prefix/share/doc/packages/doxygen
fi

214 215 216 217 218 219 220 221 222 223 224
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 --------------------------------------------------------------
225 226 227
 
if test "$f_wizard" = YES; then
  echo -n "  Checking for Qt..."
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248
  if test -d "/usr/lib/qt3/lib"; then
    if test -d "/usr/lib/qt3/include"; then
      if test -x "/usr/lib/qt3/bin/moc"; then
        QTDIR="/usr/lib/qt3";
      fi
    fi
  fi
  if test -d "/usr/lib/qt2/lib"; then
    if test -d "/usr/lib/qt2/include"; then
      if test -x "/usr/lib/qt2/bin/moc"; then
        QTDIR="/usr/lib/qt2";
      fi
    fi
  fi
  if test -d "/usr/lib/qt/lib"; then
    if test -d "/usr/lib/qt/include"; then
      if test -x "/usr/lib/qt/bin/moc"; then
        QTDIR="/usr/lib/qt";
      fi
    fi
  fi
249 250 251 252 253 254 255 256 257 258 259 260 261 262 263
  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
    if test ! -d "$QTDIR/lib"; then
      echo "QTDIR is set, but library directory does not exist!"
      exit 2
    fi
    if test ! -d "$QTDIR/include"; then
      echo "QTDIR is set, but include directory does not exist!"
      exit 2
    fi
264 265 266 267
    if test ! -x "$QTDIR/bin/moc"; then
      echo "QTDIR is set, but the moc tool could not be found in $QTDIR/bin!"
      exit 2
    fi
268 269 270 271 272
    echo " headers $QTDIR/include,"
    echo "                     libraries $QTDIR/lib"  
  fi
fi
   
273 274
# - check for make ------------------------------------------------------------

275
echo -n "  Checking for GNU make tool... "
276
if test "$f_make" = NO; then
277
  make_names="gmake make"
278 279 280 281 282
  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
283 284 285 286
        if test -n "`$j/$i --version 2>/dev/null | grep GNU`"; then
          make_prog="$j/$i"
          break 2
        fi
287 288 289 290 291 292 293 294 295 296 297 298 299
      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"

300 301 302 303 304 305 306 307 308 309 310
# - check for install ------------------------------------------------------------

echo -n "  Checking for GNU install tool... "
if test "$f_insttool" = NO; then
  install_names="ginstall install"
  install_dirs="/usr/bin /usr/local/bin /bin /sbin $bin_dirs"
  install_prog=NO
  install_found=NO
  for i in $install_names; do
    for j in $install_dirs; do
      if test -x "$j/$i"; then
311
        if test -n "`$j/$i --version 2>/dev/null | grep utils`"; then
312 313 314 315
          install_found=YES
          install_prog="$j/$i"
          break 2
        fi
316 317 318 319 320 321 322 323
      fi
    done
  done
  f_insttool="$install_prog" 
fi

if test "$f_insttool" = NO; then
  if test "$install_found" = YES; then
Dimitri van Heesch's avatar
Dimitri van Heesch committed
324
    echo;
325 326
  else
    echo "not found!";
Dimitri van Heesch's avatar
Dimitri van Heesch committed
327
    echo
328
  fi
329
  echo "GNU version of install is required: this is part of the fileutils/coreutils package: "
Dimitri van Heesch's avatar
Dimitri van Heesch committed
330
  echo "see http://www.gnu.org/software/fileutils/fileutils.html"
331 332 333 334 335 336
  echo
  exit 2
fi
echo "using $f_insttool";


337 338
# - check for dot ------------------------------------------------------------

339
echo -n "  Checking for dot (part of GraphViz)... "
340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357
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

358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390
# - 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";

391

392 393 394 395 396 397 398 399
# -----------------------------------------------------------------------------

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

cat > .makeconfig <<EOF
DOXYGEN   = $PWD
TMAKEPATH = $PWD/tmake/lib/$f_platform
Dimitri van Heesch's avatar
Dimitri van Heesch committed
400
ENV       = env TMAKEPATH=\$(TMAKEPATH)
401 402 403 404
TMAKE     = $PWD/tmake/bin/tmake
MAKE      = $f_make
PERL      = $f_perl
RM        = rm -f
405
CP        = cp
406
VERSION   = `cat VERSION`
407 408
INSTALL   = $f_prefix
INSTTOOL  = $f_insttool
409
DOXYDOCS  = ..
Dimitri van Heesch's avatar
Dimitri van Heesch committed
410
DOCDIR    = $f_docdir
411 412
EOF

413 414 415 416 417 418
if test "$f_dot" != NO; then
  cat >> .makeconfig <<EOF
HAVE_DOT  = $f_dot
EOF
fi

419 420
touch .tmakeconfig
if test "$f_shared" = NO; then
421
  if test "$f_platform" = "osf1-cxx" -o "$f_platform" = "irix-n32"; then
422
  cat >> .tmakeconfig <<EOF
Dimitri van Heesch's avatar
Dimitri van Heesch committed
423
    TMAKE_LFLAGS += -non_shared
424
EOF
Dimitri van Heesch's avatar
Dimitri van Heesch committed
425
  elif test "$f_platform" = "solaris-cc"; then
426
  cat >> .tmakeconfig <<EOF
Dimitri van Heesch's avatar
Dimitri van Heesch committed
427
    TMAKE_LFLAGS += -Bstatic
Dimitri van Heesch's avatar
Dimitri van Heesch committed
428 429 430
EOF
  elif test "$f_platform" = "hpux-cc"; then
  cat >> .tmakeconfig <<EOF
Dimitri van Heesch's avatar
Dimitri van Heesch committed
431
    TMAKE_LFLAGS += -noshared
432
EOF
433 434
  else
  cat >> .tmakeconfig <<EOF
Dimitri van Heesch's avatar
Dimitri van Heesch committed
435
    TMAKE_LFLAGS += -static
436 437
EOF
  fi
438
fi
439 440 441 442 443 444
if test "$f_wizard" = YES; then
  cat >> .tmakeconfig <<EOF
TMAKE_MOC = $QTDIR/bin/moc
EOF
fi

445
if test "$f_english" = YES; then
446
  cat >> .tmakeconfig <<EOF
Dimitri van Heesch's avatar
Dimitri van Heesch committed
447
TMAKE_CXXFLAGS += -DENGLISH_ONLY
448 449 450
EOF
fi

451
f_inmakefiles="Makefile.in qtools/Makefile.in src/Makefile.in examples/Makefile.in doc/Makefile.in addon/doxywizard/Makefile.in addon/doxmlparser/src/Makefile.in addon/doxmlparser/test/Makefile.in addon/doxmlparser/examples/metrics/Makefile.in libpng/Makefile.in libmd5/Makefile.in"
452 453

for i in $f_inmakefiles ; do
454 455 456 457 458 459 460 461 462
     SRC=$i
     DST=`echo $i|sed 's%\(.*\).in$%\1%'`
     TIME=`date`
     cat > $DST <<EOF
#
# This file was generated from `basename $i` on $TIME
#

EOF
463
     cat .makeconfig >> $DST
464
     if test $i = Makefile.in; then
465 466 467
       echo "" >> $DST
       echo "all: src/version.cpp " >> $DST
       echo "	\$(MAKE) -C qtools" >> $DST
468
       echo "	\$(MAKE) -C libpng" >> $DST
469
       echo "	\$(MAKE) -C libmd5" >> $DST
470
       echo "	\$(MAKE) -C src" >> $DST
471 472 473
       if test $f_wizard = YES; then
         echo "	\$(MAKE) -C addon/doxywizard" >> $DST
       fi
474
       echo "" >> $DST
475 476 477 478
       echo "doxywizard_install:" >> $DST
       if test $f_wizard = YES; then
         echo "	\$(MAKE) -C addon/doxywizard install" >> $DST
       fi
479
       echo "" >> $DST
480
     fi
481
     cat $SRC >> $DST
482 483 484
     echo "  Created $DST from $SRC..."
done

485
f_inprofiles="qtools/qtools.pro.in src/libdoxygen.pro.in src/libdoxycfg.pro.in src/doxygen.pro.in src/doxytag.pro.in addon/doxywizard/doxywizard.pro.in addon/doxmlparser/src/doxmlparser.pro.in addon/doxmlparser/test/xmlparse.pro.in addon/doxmlparser/examples/metrics/metrics.pro.in libpng/libpng.pro.in libmd5/libmd5.pro.in" 
486 487

for i in $f_inprofiles ; do
488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504
     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

505 506 507 508 509
# - generating src/lang_cfg.h 

echo -n "  Generating src/lang_cfg.h..."
echo $f_langs | $f_perl -e '@l=split(/,/,<STDIN>); 
        chomp @l; 
510
	@allowed=(NL,SE,CZ,FR,IT,DE,JP,JE,ES,FI,RU,HR,PL,PT,HU,KR,KE,RO,SI,CN,NO,BR,
511
		  DK,SK,UA,GR,TW,SR,CA);
512 513 514 515 516 517 518 519 520 521
	foreach my $elem (@l){ 
	     $elem =~ tr/a-z/A-Z/;
	     $r=0;
	     foreach my $tst (@allowed){
		if ($tst eq $elem) { $r=1; last; } 		
	     }	    
	     if ($r!=1) { die "ERROR: Invalid language $elem was selected!\n"; } 
	     print "#define LANG_$elem\n";
        };' > ./src/lang_cfg.h   
echo