configure 26.9 KB
Newer Older
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1
#!/bin/sh
2 3 4
#
# $Id$
#
Dimitri van Heesch's avatar
Dimitri van Heesch committed
5
# Copyright (C) 1997-2014 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
# 
# shell script to configure doxygen

18
doxygen_version_major=1
Dimitri van Heesch's avatar
Dimitri van Heesch committed
19
doxygen_version_minor=8
20
doxygen_version_revision=8
21 22

#NOTE: Setting version_mmn to "NO" will omit mmn info from the package.
Dimitri van Heesch's avatar
Dimitri van Heesch committed
23
doxygen_version_mmn=NO
24

25 26 27 28 29
bin_dirs=`echo $PATH | sed -e "s/:/ /g"`

f_debug=NO
f_shared=YES
f_make=NO
30
f_dot=NO
31
f_perl=NO
32
f_python=NO
33
f_plf_auto=NO
Dimitri van Heesch's avatar
Dimitri van Heesch committed
34
f_prefix=/usr/local
35
f_insttool=NO
36
f_english=NO
37
f_wizard=NO
38
f_app=NO
39
f_doxmlparser=NO
40
f_thread=NO
41 42
f_flex=NO
f_bison=NO
Dimitri van Heesch's avatar
Dimitri van Heesch committed
43
f_search=NO
44
f_sqlite3=NO
45 46
f_sqlite3static=NO
f_sqlite3_path=NO
47
f_libclang=NO
48
f_libclangstatic=NO
49

50 51 52 53
#
# first setup the list with availabe languages, so we cannot forget any
# list will be in case as specified (f_langs) and in uppercase (f_ulangs) as used in the internal perl script
#
54
f_langs=`ls -1 src/translator_??.h | sed -e 's%src/translator_%%g' | sed -e 's/\.h//' | tr '\012' ','`
55

56
while test -n "$1";  do
57
  case $1 in
58 59 60
    --prefix=*)
       f_prefix=`echo $1 | sed 's/^--prefix=//'`
       ;;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
61
    --prefix | -prefix)
62 63
       shift; f_prefix=$1
       ;;
64 65 66
    --docdir=*)
       f_docdir=`echo $1 | sed 's/^--docdir=//'`
       ;;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
67
    --docdir | -docdir)
Dimitri van Heesch's avatar
Dimitri van Heesch committed
68
       shift; f_docdir=$1
Dimitri van Heesch's avatar
Dimitri van Heesch committed
69 70
       ;;
    --shared | -shared)
71 72
       f_shared=YES
       ;;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
73
    --static | -static)
74 75
       f_shared=NO
       ;;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
76
    --release | -release)
77 78
       f_debug=NO
       ;;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
79
    --debug | -debug)
80 81
       f_debug=YES
       ;;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
82
    --english-only | -english-only)
83 84
       f_english=YES
       ;;
85 86 87
    --enable-langs=*)
       f_langs=`echo $1 | sed 's/^--enable-langs=//'`
       ;;
88 89 90
    --enable-langs | -enable-langs)
       shift; f_langs=$1
       ;;
91 92 93
    --platform=*)
       f_platform=`echo $1 | sed 's/^--platform=//'`
       ;;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
94
    --platform | -platform)
95 96
       shift; f_platform=$1
       ;;
97 98 99
    --make=*)
       f_make=`echo $1 | sed 's/^--make=//'`
       ;;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
100
    --make | -make)
101 102
       shift; f_make=$1
       ;;
103 104 105
    --dot=*)
       f_dot=`echo $1 | sed 's/^--dot=//'`
       ;;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
106
    --dot | -dot)
107 108
       shift; f_dot=$1
       ;;
109 110 111
    --python=*)
       f_python=`echo $1 | sed 's/^--python=//'`
       ;;
112 113 114
    --python | -python)
       shift; f_python=$1
       ;;
115 116 117
    --perl=*)
       f_perl=`echo $1 | sed 's/^--perl=//'`
       ;;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
118
    --perl | -perl)
119 120
       shift; f_perl=$1
       ;;
121 122 123
    --flex=*)
       f_flex=`echo $1 | sed 's/^--flex=//'`
       ;;
124 125 126
    --flex | -flex)
       shift; f_flex=$1
       ;;
127 128 129
    --bison=*)
       f_bison=`echo $1 | sed 's/^--bison=//'`
       ;;
130 131 132
    --bison | -bison)
       shift; f_bison=$1
       ;;
133 134 135
    --install=*)
       f_insttool=`echo $1 | sed 's/^--install=//'`
       ;;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
136
    --install | -install)
137 138
       shift; f_insttool=$1
       ;;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
139
    --with-doxywizard | -with-doxywizard)
140 141
       f_wizard=YES
       ;;
142 143 144
    --with-doxyapp | -with-doxyapp)
       f_app=YES
       ;;
145 146 147
    --with-doxmlparser | -with-doxmlparser)
       f_doxmlparser=YES
       ;;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
148 149 150
    --with-doxysearch | -with-doxysearch)
       f_search=YES
       ;;
151 152 153
    --with-sqlite3 | -with-sqlite3)
       f_sqlite3=YES
       ;;
154 155 156 157
    --with-sqlite3-static | -with-sqlite3-static)
       f_sqlite3=YES
       f_sqlite3static=YES
       ;;
158 159 160
    --sqlite3-path=*)
       f_sqlite3_path=`echo $1 | sed 's/^--sqlite3-path=//'`
       ;;
161 162 163
    --sqlite3-path | -sqlite3-path)
       shift; f_sqlite3_path=$1
       ;;
164 165 166
    --with-libclang | -with-libclang)
       f_libclang=YES
       ;;
167 168 169 170
    --with-libclang-static | -with-libclang-static)
       f_libclang=YES
       f_libclangstatic=YES
       ;;
171 172 173 174 175 176 177 178 179 180 181 182 183 184
    -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
185
Usage: $0 [--help] [--shared] [--static] [--release] [--debug] [--python name]
186 187
          [--perl name] [--flex name] [--bison name] [--make name] 
          [--dot name] [--platform target] [--prefix dir] [--docdir dir] 
188
          [--install name] [--english-only] [--enable-langs list] 
189 190
          [--with-sqlite3] [--with-sqlite3-static] [--sqlite3-path]
          [--with-libclang] [--with-libclang-static]
Dimitri van Heesch's avatar
Dimitri van Heesch committed
191
          [--with-doxywizard] [--with-doxysearch] [--with-doxyapp]
192
          [--with-doxxmlparser]
193

194
Options: 
195

196 197 198 199 200
  --help                Print this help
  --shared | --static   Build using shared or static linking
		        [default: shared]
  --release | --debug   Build for release or debug 
		        [default: release]
201 202
  --python name         Use \`name' as the name of the python interpreter 
		        [default: autodetect]
203 204
  --perl name           Use \`name' as the name of the perl interpreter 
		        [default: autodetect]
205 206 207 208
  --flex name           Use \`name' as the name of the GNU lexical scanner 
		        [default: autodetect]
  --bison name          Use \`name' as the name of the GNU compiler generator 
		        [default: autodetect]
209 210
  --make name           Use \`name' as the name of the GNU make tool
		        [default: autodetect]
211 212 213
  --dot name            Use \`name' as the name of the dot tool that
                        is part of the Graphviz package.
                        [default: autodetect]
214 215
  --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
216 217
  --prefix dir          Installation prefix directory (doxygen will be
                        put in PREFIX/bin/doxygen)
218
                        [default: $f_prefix]
Dimitri van Heesch's avatar
Dimitri van Heesch committed
219 220
  --docdir dir          Documentation is installed in DOCDIR/
                        [default: PREFIX/share/doc/packages/doxygen]
221
  --install name        Use \`name' as the name of the GNU install tool
222
                        [default: autodetect]
223
  --english-only        Include support for English only.
224 225
  --enable-langs list 	Include support for output languages listed in list.
  			[default: $f_langs]
226
  --with-sqlite3        Add support for sqlite3 output [experimental]
227
  --with-libclang       Add support for libclang parsing
228
  --with-doxywizard     Build the GUI frontend for doxygen. This
229
                        requires Qt version 4.
Dimitri van Heesch's avatar
Dimitri van Heesch committed
230 231
  --with-doxysearch     Build external search tools (doxysearch and doxyindexer)
                        requires Xapian library version 1.2
232
  --with-doxyapp        Example showing how to embed doxygen in an application.
233
  --with-doxmlparser    Example showing how to parse doxygen's XML output.
234

235 236 237 238 239 240 241 242 243 244 245 246 247 248 249
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
      ;;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
250 251 252
    BeOS*)
      f_platform=beos-g++
      ;;
253 254 255
    dgux:*)
      f_platform=dgux-g++
      ;;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
256 257
    Darwin:*)
      f_platform=macosx-c++
258 259 260
      if test "$f_insttool" = NO; then
        f_insttool=/usr/bin/install
      fi
Dimitri van Heesch's avatar
Dimitri van Heesch committed
261
      ;;
262 263
    FreeBSD:*)
      f_platform=freebsd-g++
264 265 266
      if test "$f_insttool" = NO; then
        f_insttool=/usr/bin/install
      fi
267
      ;;
268 269 270 271 272 273
    NetBSD:*)
      f_platform=netbsd-g++
      if test "$f_insttool" = NO; then
        f_insttool=/usr/bin/install
      fi
      ;;
274 275
    HP-UX:*)
      f_platform=hpux-g++
276 277 278
      if test "$f_insttool" = NO; then
        f_insttool=/usr/bin/install
      fi
279 280 281 282 283 284 285
      ;;
    IRIX64:*)
      f_platform=irix-64
      ;;
    IRIX:*)
      f_platform=irix-n32
      ;;
286
    Linux:*|GNU:*|GNU/*:*)
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307
      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*)
308
      f_platform=solaris-g++
309 310 311
      if test "$f_insttool" = NO; then
        f_insttool=/usr/bin/install
      fi
312 313 314 315 316 317 318
      ;;
    ULTRIX:*)
      f_platform=ultrix-g++
      ;;
    UNIX_SV:4.2*)
      f_platform=unixware-g++
      ;;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
319
    Cygwin:*|CYGWIN*)
320 321
      f_platform=win32-g++
      ;;
322 323 324
    MINGW32_NT*)
      f_platform=win32-mingw
      ;;
325 326 327
    *MiNT:*)
      f_platform=m68k-atari-mint-g++
      ;;
328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344
    *)
    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
345
if test -z "$f_docdir"; then
346
  f_docdir='$(INSTALL)/share/doc/packages/doxygen'
Dimitri van Heesch's avatar
Dimitri van Heesch committed
347 348
fi

349
if test "$f_plf_auto" = NO; then
350
  printf "  Checking for platform $f_platform... "
351 352 353 354 355 356 357 358 359
  if test '!' -d tmake/lib/$f_platform; then
    echo "not supported!" 
    echo
    exit 2
  fi
  echo "supported"
fi

#- check for qt --------------------------------------------------------------
360 361
 
if test "$f_wizard" = YES; then
362 363
  if test -z "$QTDIR"; then
    echo "  QTDIR environment variable not set!"
364
    printf "  Checking for Qt..."
Dimitri van Heesch's avatar
Dimitri van Heesch committed
365
    for d in /usr/{lib,share,qt}/{qt-4,qt4,qt,qt*,4} /usr; do
366
      if test -x "$d/bin/qmake"; then
367
        QTDIR=$d
368
        break 2
369
      fi
370 371
    done
  else
372 373 374 375 376 377 378 379
    if test -e "$QTDIR/bin/qmake"; then
      printf "  Detected Qt via the QTDIR environment variable..."
    else
      printf "ERROR Detected Qt via the QTDIR environment variable..."
      echo ", but $QTDIR/bin/qmake does not exist."
      echo "      Set the QTDIR environment variable such that \$QTDIR/bin/qmake exists."
      exit 2
    fi
380
  fi
381
  if test -z "$QTDIR"; then
382
    echo "QTDIR not set and Qt not found at standard locations!"
383
    echo
384
    echo "Set the QTDIR environment variable such that \$QTDIR/bin/qmake exists."
Dimitri van Heesch's avatar
Dimitri van Heesch committed
385
    echo "check the Qt installation instructions!"
386 387
    exit 2
  fi
388
  echo using $QTDIR
389
fi
Dimitri van Heesch's avatar
Dimitri van Heesch committed
390 391 392 393 394

#- check for xapian -----------------------------------------------------------

if test "$f_search" = YES; then
  if test -z "$XAPIAN"; then
395
    printf "  Checking for Xapian..."
Dimitri van Heesch's avatar
Dimitri van Heesch committed
396 397 398
    for d in /usr /usr/local /opt/local; do
      if test -e "$d/include/xapian.h"; then
        XAPIAN=$d
399
        break 2
Dimitri van Heesch's avatar
Dimitri van Heesch committed
400 401
      fi
    done
402 403 404 405 406 407 408 409 410
  else
    if test -e "$XAPIAN/include/xapian.h"; then
      printf "  Detected Xapian via the XAPIAN environment variable..."
    else
      printf "ERROR Detected Xapian via the XAPIAN environment variable..."
      echo ", but $XAPIAN/include/xapian.h does not exist."
      echo "      Set the XAPIAN environment variable such that \$XAPIAN/include/xapian.h exists."
      exit 2
    fi
Dimitri van Heesch's avatar
Dimitri van Heesch committed
411 412 413 414 415
  fi
  if test -z "$XAPIAN"; then
    echo "XAPIAN not set and xapian.h not found at standard locations!"
    exit 2;
  fi
416
  echo using $XAPIAN
Dimitri van Heesch's avatar
Dimitri van Heesch committed
417
fi
418
   
419 420
# - check for make ------------------------------------------------------------

421
printf "  Checking for GNU make tool... "
422
if test "$f_make" = NO; then
423
  make_names="gmake make"
424
  make_dirs="$bin_dirs /usr/bin /usr/local/bin /bin /sbin"
425 426 427 428
  make_prog=NO
  for i in $make_names; do
    for j in $make_dirs; do
      if test -x "$j/$i"; then
429 430 431 432
        if test -n "`$j/$i --version 2>/dev/null | grep GNU`"; then
          make_prog="$j/$i"
          break 2
        fi
433 434 435 436 437 438 439 440 441 442 443 444 445
      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"

446 447
# - check for install ------------------------------------------------------------

448
printf "  Checking for GNU install tool... "
449 450
if test "$f_insttool" = NO; then
  install_names="ginstall install"
451
  install_dirs="$bin_dirs /usr/bin /usr/local/bin /bin /sbin /usr/ucb"
452 453 454 455 456
  install_prog=NO
  install_found=NO
  for i in $install_names; do
    for j in $install_dirs; do
      if test -x "$j/$i"; then
457
        if test -n "`$j/$i --version 2>/dev/null | grep utils`"; then
458 459 460 461
          install_found=YES
          install_prog="$j/$i"
          break 2
        fi
462 463 464 465 466 467 468 469
      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
470
    echo;
471 472
  else
    echo "not found!";
Dimitri van Heesch's avatar
Dimitri van Heesch committed
473
    echo
474
  fi
475
  echo "GNU version of install is required: this is part of the fileutils/coreutils package: "
Dimitri van Heesch's avatar
Dimitri van Heesch committed
476
  echo "see http://www.gnu.org/software/fileutils/fileutils.html"
477 478 479 480 481 482
  echo
  exit 2
fi
echo "using $f_insttool";


483 484
# - check for dot ------------------------------------------------------------

485
printf "  Checking for dot (part of GraphViz)... "
486
if test "$f_dot" = NO; then
487
  dot_dirs="$bin_dirs /usr/bin /usr/local/bin /bin /sbin"
488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503
  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

504 505 506
# - check for sqlite3 ---------------------------------------------------------

if test "$f_sqlite3" = YES; then
507
  printf "  Checking for sqlite3 ... "
508
  if test "$f_sqlite3_path" = NO; then
509
    sqlite3_hdr_dir="/usr/include /usr/local/include /opt/local/include"
510
    sqlite3_lib_dir="/usr/lib /usr/local/lib /opt/local/lib /usr/lib/x86_64-linux-gnu /usr/lib64"
511 512 513 514 515
  else
    sqlite3_hdr_dir="$f_sqlite3_path/include"
    sqlite3_lib_dir="$f_sqlite3_path/lib"
  fi
  if test "$f_sqlite3static" = NO; then
516
    sqlite3_lib_name="libsqlite3.so libsqlite3.dylib libsqlite3.a libsqlite3.dll.a"
517 518 519
  else
    sqlite3_lib_name="libsqlite3.a"
  fi
520 521 522 523 524 525 526 527 528 529 530 531
  sqlite3_hdr=NO
  sqlite3_lib=NO
  sqlite3_link=
  for j in $sqlite3_hdr_dir; do
    if test -f "$j/sqlite3.h"; then
      sqlite3_hdr="$j/sqlite3.h"
      break
    fi
  done
  for i in $sqlite3_lib_dir; do
    if test "$sqlite3_lib" = NO; then
      for j in $sqlite3_lib_name; do
532
        if test -e "$i/$j"; then
533 534 535 536 537 538 539
          if test "$f_sqlite3static" = NO; then
            sqlite3_lib="$i/$j"
            sqlite3_link="-L$i -lsqlite3"
          else
            sqlite3_lib="$i/$j"
            sqlite3_link="$i/$j -ldl"
          fi
540 541 542 543 544 545 546
          break
        fi
      done
    fi
  done
  if test "$sqlite3_hdr" = NO -o "$sqlite3_lib" = NO; then
    echo "not found!";
547
    exit 1
548 549 550 551 552
  else
    echo "using header $sqlite3_hdr and library $sqlite3_lib...";
  fi
fi

553 554 555 556
# - check for libclang ---------------------------------------------------------

if test "$f_libclang" = YES; then
  printf "  Checking for libclang ... "
557
  libclang_hdr_dir="/usr/include /usr/local/include /opt/local/include"
558
  libclang_lib_dir="/usr/lib /usr/local/lib /opt/local/lib /usr/lib64/llvm /usr/lib/llvm"
559
  if test "$f_libclangstatic" = NO; then
560
    libclang_lib_name="libclang.so libclang.dylib libclang.a libclang.dll.a"
561 562 563
  else
    libclang_lib_name="libclang.a"
  fi
564 565 566 567 568 569 570 571 572 573 574 575 576 577
  libclang_hdr=NO
  libclang_lib=NO
  libclang_link=
  for j in $libclang_hdr_dir; do
    if test -f "$j/clang-c/Index.h"; then
      libclang_hdr="$j/clang-c/Index.h"
      break
    fi
  done
  for i in $libclang_lib_dir; do
    if test "$libclang_lib" = NO; then
      for j in $libclang_lib_name; do
        if test -f "$i/$j"; then
          libclang_lib="$i/$j"
578 579 580
          if test "$f_libclangstatic" = NO; then
            libclang_link="-L $i -lclang"
          else
Dimitri van Heesch's avatar
Dimitri van Heesch committed
581
            libclang_link="$i/libclang.a $i/libclangFrontend.a $i/libclangSerialization.a $i/libclangParse.a $i/libclangSema.a $i/libclangAnalysis.a $i/libclangStaticAnalyzerCore.a $i/libclangAST.a $i/libclangBasic.a $i/libclangDriver.a $i/libclangEdit.a $i/libclangLex.a $i/libclangRewriteCore.a $i/libLLVMBitReader.a $i/libLLVMMC.a $i/libLLVMMCParser.a $i/libLLVMSupport.a -ldl -lpthread"
582
          fi
583 584 585 586 587 588 589 590 591 592 593
          break
        fi
      done
    fi
  done
  if test "$libclang_hdr" = NO -o "$libclang_lib" = NO; then
    echo "not found!";
  else
    echo "using header $libclang_hdr and library $libclang_lib...";
  fi
fi
594

595 596
# - check for python ----------------------------------------------------------

597
python_version=0
598 599
printf "  Checking for python... "
if test "$f_python" = NO; then
600
  python_names="python3 python2 python"
601 602 603 604 605 606 607
  python_dirs="$bin_dirs /usr/bin /usr/local/bin /bin /sbin"
  python_prog=NO
  python_found=NO
  for i in $python_names; do
    for j in $python_dirs; do
      if test -x "$j/$i"; then
        python_found=YES
608 609 610
        if test `$j/$i -c "import sys; print(sys.version_info[0])"` = 3; then
          python_prog="$j/$i";
          python_version=`$j/$i -c "import platform; print(platform.python_version())"`;
611
          break 2
612 613 614 615 616 617
        elif test `$j/$i -c "import sys; print(sys.version_info[0])"` = 2; then
          if test `$j/$i -c "import sys; print(sys.version_info[1])"` -ge 6; then
            python_prog="$j/$i";
            python_version=`$j/$i -c "import platform; print(platform.python_version())"`;
            break 2
          fi
618 619 620 621
        fi
      fi
    done
  done
622
  f_python="$python_prog"
623 624 625 626
fi

if test "$f_python" = NO; then
  if test "$python_found" = YES; then
627
    echo "version should be python 2.6 or higher."
628 629 630 631 632 633
  else
    echo "not found!";
  fi
  echo
  exit 2
fi
634
echo "using $f_python (version $python_version)";
635

636 637
# - check for perl ------------------------------------------------------------

638
printf "  Checking for perl... "
639 640
if test "$f_perl" = NO; then
  perl_names="perl perl5"
641
  perl_dirs="$bin_dirs /usr/bin /usr/local/bin /bin /sbin"
642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668
  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";

669 670
# - check for flex ------------------------------------------------------------

671
printf "  Checking for flex... "
672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694
if test "$f_flex" = NO; then
  flex_dirs="$bin_dirs /usr/bin /usr/local/bin /bin"
  flex_prog=NO
  flex_found=NO
  for j in $flex_dirs; do
    if test -x "$j/flex"; then
      flex_found=YES
      flex_prog="$j/flex"
      break
    fi
  done
  f_flex="$flex_prog" 
fi

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

# - check for bison ------------------------------------------------------------

695
printf "  Checking for bison... "
696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715
if test "$f_bison" = NO; then
  bison_dirs="$bin_dirs /usr/bin /usr/local/bin /bin"
  bison_prog=NO
  bison_found=NO
  for j in $bison_dirs; do
    if test -x "$j/bison"; then
      bison_found=YES
      bison_prog="$j/bison"
      break
    fi
  done
  f_bison="$bison_prog" 
fi

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

717 718
# -----------------------------------------------------------------------------

719 720 721
if test '!' -d "generated_src/doxygen"; then
  mkdir -p generated_src/doxygen
fi
722
if test "$f_wizard" = YES; then
723 724 725
  if test '!' -d "generated_src/doxywizard"; then
    mkdir -p generated_src/doxywizard
  fi
726 727
fi

728 729 730
#
# Make VERSION file
#
731 732 733 734 735 736 737 738 739 740 741 742 743 744
test -f "VERSION" && chmod u+w VERSION
test -f "generated_src/doxygen/version.cpp" && chmod u+w generated_src/doxygen/version.cpp
echo "  Generating generated_src/doxygen/version.cpp and VERSION..."
cd src
$f_python version.py ../generated_src/doxygen
cd ..
if test "$f_wizard" = YES; then
  test -f "VERSION" && chmod u+w VERSION
  test -f "generated_src/doxywizard/version.cpp" && chmod u+w generated_src/doxywizard/version.cpp
  echo "  Generating generated_src/doxywizard/version.cpp and VERSION..."
  cd src
  $f_python version.py ../generated_src/doxywizard
  cd ..

745 746
fi

747 748 749
test -f .makeconfig && rm .makeconfig
test -f .tmakeconfig && rm .tmakeconfig

750
configPWD=`pwd`
751

752
cat > .makeconfig <<EOF
753 754
DOXYGEN   = $configPWD
TMAKEPATH = $configPWD/tmake/lib/$f_platform
755
ENV       = env TMAKEPATH="\$(TMAKEPATH)"
756
TMAKE     = $configPWD/tmake/bin/tmake
757
MAKE      = $f_make
758
PYTHON    = $f_python
759
PERL      = $f_perl
760
LEX       = $f_flex
761
RM        = rm -f
762
CP        = cp
763
VERSION   = `cat VERSION`
764 765
INSTALL   = $f_prefix
INSTTOOL  = $f_insttool
766
DOXYDOCS  = ..
Dimitri van Heesch's avatar
Dimitri van Heesch committed
767
DOCDIR    = $f_docdir
768
QTDIR     = $QTDIR
769 770
EOF

771 772 773 774 775 776
if test "$f_dot" != NO; then
  cat >> .makeconfig <<EOF
HAVE_DOT  = $f_dot
EOF
fi

777

778 779 780 781 782 783
if test "$f_platform" = "m68k-atari-mint-g++"; then
  cat >> .makeconfig <<EOF
TMAKE += -unix
EOF
fi

784 785 786 787 788 789 790 791 792
if test "$f_platform" = "macosx-c++"; then
  cat >> .makeconfig <<EOF
MKSPECS   = -spec macx-g++
EOF
fi
if test "$f_platform" = "macosx-uni-c++"; then
  cat >> .makeconfig <<EOF
MKSPECS   = -spec macx-g++
EOF
Dimitri van Heesch's avatar
Dimitri van Heesch committed
793
fi
794

795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810
# Make doxygen.spec...
#
echo "  Created doxygen.spec file, for rpm generation."

echo "%define version $doxygen_version_major.$doxygen_version_minor.$doxygen_version_revision" > spec.tmp
if test "$doxygen_version_mmn" = NO; then
  echo "%define revision 1" >> spec.tmp
  echo "%define mmn 1"      >> spec.tmp
else
  echo "%define revision $doxygen_version_mmn" >> spec.tmp
  echo "%define mmn $doxygen_version_mmn"      >> spec.tmp
fi

mkdir -p packages
mkdir -p packages/rpm

811
cat spec.tmp ./packages/rpm/doxygen.spec.in > ./packages/rpm/doxygen.spec
812 813 814 815 816 817

rm -f spec.tmp


# make .tmakeconfig
#
818 819
touch .tmakeconfig
if test "$f_shared" = NO; then
820
  if test "$f_platform" = "osf1-cxx" -o "$f_platform" = "irix-n32"; then
821
  cat >> .tmakeconfig <<EOF
Dimitri van Heesch's avatar
Dimitri van Heesch committed
822
    TMAKE_LFLAGS += -non_shared
823
EOF
Dimitri van Heesch's avatar
Dimitri van Heesch committed
824
  elif test "$f_platform" = "solaris-cc"; then
825
  cat >> .tmakeconfig <<EOF
Dimitri van Heesch's avatar
Dimitri van Heesch committed
826
    TMAKE_LFLAGS += -Bstatic
Dimitri van Heesch's avatar
Dimitri van Heesch committed
827 828 829
EOF
  elif test "$f_platform" = "hpux-cc"; then
  cat >> .tmakeconfig <<EOF
Dimitri van Heesch's avatar
Dimitri van Heesch committed
830
    TMAKE_LFLAGS += -noshared
831
EOF
832 833
  else
  cat >> .tmakeconfig <<EOF
Dimitri van Heesch's avatar
Dimitri van Heesch committed
834
    TMAKE_LFLAGS += -static
835 836
EOF
  fi
837
fi
838
if test "$f_platform" = "hpux-g++" -o "$f_platform" = "linux-g++"; then
839 840 841 842
  cat >> .tmakeconfig <<EOF
    TMAKE_CXXFLAGS += -D_LARGEFILE_SOURCE
EOF
fi
843
if test "$f_platform" = "macosx-uni-c++"; then
844
  if test -n "`ls /Developer/SDKs/MacOSX10.*.sdk 2>/dev/null`"; then
845 846
    mac_sdk=MacOSX10.4u.sdk
  fi
847
  if test -n "`ls /Developer/SDKs/MacOSX10.5*.sdk 2>/dev/null`"; then
848 849 850 851 852 853 854 855 856 857
    mac_sdk=MacOSX10.5.sdk
  fi
  if test -n $mac_sdk; then
  cat >> .tmakeconfig <<EOF
    TMAKE_CFLAGS   += -isysroot /Developer/SDKs/$mac_sdk
    TMAKE_CXXFLAGS += -isysroot /Developer/SDKs/$mac_sdk
    TMAKE_LFLAGS   += -Wl,-syslibroot,/Developer/SDKs/$mac_sdk
EOF
  fi
fi
858 859 860 861 862 863
if test "$f_wizard" = YES; then
  cat >> .tmakeconfig <<EOF
TMAKE_MOC = $QTDIR/bin/moc
EOF
fi

Dimitri van Heesch's avatar
Dimitri van Heesch committed
864 865 866 867 868 869 870
if test "$f_search" = YES; then
  cat >> .tmakeconfig <<EOF
LIBS += -L$XAPIAN/lib
INCLUDEPATH += $XAPIAN/include
EOF
fi

871
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 libmd5/Makefile.in addon/doxyapp/Makefile.in addon/doxysearch/Makefile.in vhdlparser/Makefile.in"
872 873

for i in $f_inmakefiles ; do
874 875 876 877 878 879 880 881 882
     SRC=$i
     DST=`echo $i|sed 's%\(.*\).in$%\1%'`
     TIME=`date`
     cat > $DST <<EOF
#
# This file was generated from `basename $i` on $TIME
#

EOF
883
     cat .makeconfig >> $DST
884
     if test $i = Makefile.in; then
885
       echo "" >> $DST
Dimitri van Heesch's avatar
Dimitri van Heesch committed
886 887 888 889
       EXTRADEPS=
       if test $f_wizard = YES; then
         EXTRADEPS=doxywizard
       fi
Dimitri van Heesch's avatar
Dimitri van Heesch committed
890 891 892
#       if test $f_search = YES; then
#         EXTRADEPS="$EXTRADEPS doxysearch"
#       fi
893
       echo "all: generated_src/doxygen/version.cpp $EXTRADEPS" >> $DST
894
       echo "	\$(MAKE) -C qtools" >> $DST
895
       echo "	\$(MAKE) -C libmd5" >> $DST
896
       echo "	\$(MAKE) -C vhdlparser" >> $DST
897
       echo "	\$(MAKE) -C src" >> $DST
898

899
       if test $f_wizard = YES; then
Dimitri van Heesch's avatar
Dimitri van Heesch committed
900
         echo "	\$(MAKE) MAN1DIR=\$(MAN1DIR) -C addon/doxywizard" >> $DST
901
       fi
Dimitri van Heesch's avatar
Dimitri van Heesch committed
902 903 904
       if test $f_search = YES; then
         echo "	\$(MAKE) -C addon/doxysearch" >> $DST
       fi
905 906 907
       if test $f_app = YES; then
         echo "	\$(MAKE) -C addon/doxyapp" >> $DST
       fi
908 909 910 911 912
       if test $f_doxmlparser = YES; then
         echo "	\$(MAKE) -C addon/doxmlparser/src" >> $DST
         echo "	\$(MAKE) -C addon/doxmlparser/test" >> $DST
         echo "	\$(MAKE) -C addon/doxmlparser/examples/metrics" >> $DST
       fi
913
       echo "" >> $DST
914 915
       echo "doxywizard_install:" >> $DST
       if test $f_wizard = YES; then
916
         echo "	\$(MAKE) INSTALL=\$(DESTDIR)\$(INSTALL) MAN1DIR=\$(MAN1DIR) -C addon/doxywizard install" >> $DST
917
       fi
Dimitri van Heesch's avatar
Dimitri van Heesch committed
918 919
       echo "doxysearch_install:" >> $DST
       if test $f_search = YES; then
920
         echo "	\$(MAKE) INSTALL=\$(DESTDIR)\$(INSTALL) MAN1DIR=\$(MAN1DIR) -C addon/doxysearch install" >> $DST
Dimitri van Heesch's avatar
Dimitri van Heesch committed
921
       fi
922
       echo "" >> $DST
923
     fi
924 925 926 927 928
     if test $f_wizard = YES; then
       sed -e "s/%%WITHDOXYWIZARD%% /--with doxywizard /g" $SRC >> $DST
     else
       sed -e "s/%%WITHDOXYWIZARD%% //g" $SRC >> $DST
     fi
929 930 931
     echo "  Created $DST from $SRC..."
done

932 933
cat src/libdoxycfg.t.in | sed -e "s|%%FLEX%%|$f_flex|g" -e "s|%%BISON%%|$f_bison|g" -e "s|%%PYTHON%%|$f_python|g" > src/libdoxycfg.t
cat src/libdoxygen.t.in | sed -e "s|%%FLEX%%|$f_flex|g" -e "s|%%BISON%%|$f_bison|g" -e "s|%%PYTHON%%|$f_python|g" > src/libdoxygen.t
934

935
f_inprofiles="qtools/qtools.pro.in src/libdoxygen.pro.in src/libdoxycfg.pro.in src/doxygen.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 libmd5/libmd5.pro.in addon/doxyapp/doxyapp.pro.in addon/doxysearch/doxysearch.pro.in addon/doxysearch/doxyindexer.pro.in vhdlparser/vhdlparser.pro.in"
936 937

for i in $f_inprofiles ; do
938 939 940 941 942 943 944 945 946 947
     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
948
       realopts="release"
949
     else
950 951
       realopts="debug"
     fi
952 953 954
     #if test "$f_thread" = YES; then
     #  realopts="$realopts thread"
     #fi
955
     cat $SRC .tmakeconfig | sed -e "s/\$extraopts/$realopts/g" -e "s;%%SQLITE3_INC%%;$sqlite3_hdr_dir;g" -e "s;%%SQLITE3_LIBS%%;$sqlite3_link;g" -e "s;%%LIBCLANG_LIBS%%;$libclang_link;g" >> $DST
956 957 958
     echo "  Created $DST from $SRC..."
done

959
# - generating generated_src/doxygen/doxygen/lang_cfg.h 
960
# use consistent method on Linux and Windows
961

962 963
if test -f "generated_src/doxygen/lang_cfg.h"; then
    chmod u+w generated_src/doxygen/lang_cfg.h   # make sure file can be overwritten
964
fi
965
echo "  Generating generated_src/doxygen/lang_cfg.h..."
966
if test "$f_english" = YES; then
967
   $f_python src/lang_cfg.py ENONLY > generated_src/doxygen/lang_cfg.h
968
else
969
   f_ulangs=`echo $f_langs | tr '[a-z]' '[A-Z]' | tr ',' ' '`
970
   $f_python src/lang_cfg.py $f_ulangs > generated_src/doxygen/lang_cfg.h
971
fi
972

973 974
if test -f "generated_src/doxygen/settings.h"; then
    chmod u+w generated_src/doxygen/settings.h
975
fi
976 977 978 979 980 981 982 983 984
echo "  Generating generated_src/doxygen/settings.h..."
$f_python src/settings.py $f_sqlite3 $f_libclang generated_src/doxygen

if test "$f_wizard" = YES; then
  if test -f "generated_src/doxywizard/settings.h"; then
      chmod u+w generated_src/doxywizard/settings.h
  fi
  echo "  Generating generated_src/doxywizard/settings.h..."
  $f_python src/settings.py $f_sqlite3 $f_libclang generated_src/doxywizard
985
fi
986

987 988
cd ..
echo "  Finished"