configure 22.3 KB
Newer Older
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1
#!/bin/sh
2 3 4
#
# $Id$
#
5
# Copyright (C) 1997-2013 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
Dimitri van Heesch's avatar
Dimitri van Heesch committed
20
doxygen_version_revision=4
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 32
f_perl=NO
f_plf_auto=NO
Dimitri van Heesch's avatar
Dimitri van Heesch committed
33
f_prefix=/usr/local
34
f_insttool=NO
35
f_english=NO
36
f_wizard=NO
37
f_app=NO
38
f_thread=NO
39 40
f_flex=NO
f_bison=NO
Dimitri van Heesch's avatar
Dimitri van Heesch committed
41
f_search=NO
42
f_langs=nl,sv,cz,fr,id,it,de,jp,je,es,fi,ru,hr,pl,pt,hu,kr,ke,ro,si,cn,no,mk,br,dk,sk,ua,gr,tw,sr,ca,lt,za,ar,fa,sc,vi,tr,eo,am
43
f_sqlite3=NO
44
f_libclang=NO
45
f_libclangstatic=NO
46

47
while test -n "$1";  do
48
  case $1 in
Dimitri van Heesch's avatar
Dimitri van Heesch committed
49
    --prefix | -prefix)
50 51
       shift; f_prefix=$1
       ;;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
52
    --docdir | -docdir)
Dimitri van Heesch's avatar
Dimitri van Heesch committed
53
       shift; f_docdir=$1
Dimitri van Heesch's avatar
Dimitri van Heesch committed
54 55
       ;;
    --shared | -shared)
56 57
       f_shared=YES
       ;;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
58
    --static | -static)
59 60
       f_shared=NO
       ;;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
61
    --release | -release)
62 63
       f_debug=NO
       ;;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
64
    --debug | -debug)
65 66
       f_debug=YES
       ;;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
67
    --english-only | -english-only)
68 69
       f_english=YES
       ;;
70 71 72
    --enable-langs | -enable-langs)
       shift; f_langs=$1
       ;;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
73
    --platform | -platform)
74 75
       shift; f_platform=$1
       ;;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
76
    --make | -make)
77 78
       shift; f_make=$1
       ;;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
79
    --dot | -dot)
80 81
       shift; f_dot=$1
       ;;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
82
    --perl | -perl)
83 84
       shift; f_perl=$1
       ;;
85 86 87 88 89 90
    --flex | -flex)
       shift; f_flex=$1
       ;;
    --bison | -bison)
       shift; f_bison=$1
       ;;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
91
    --install | -install)
92 93
       shift; f_insttool=$1
       ;;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
94
    --with-doxywizard | -with-doxywizard)
95 96
       f_wizard=YES
       ;;
97 98 99
    --with-doxyapp | -with-doxyapp)
       f_app=YES
       ;;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
100 101 102
    --with-doxysearch | -with-doxysearch)
       f_search=YES
       ;;
103 104 105
    --with-sqlite3 | -with-sqlite3)
       f_sqlite3=YES
       ;;
106 107 108
    --with-libclang | -with-libclang)
       f_libclang=YES
       ;;
109 110 111 112
    --with-libclang-static | -with-libclang-static)
       f_libclang=YES
       f_libclangstatic=YES
       ;;
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
    -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] 
128 129
          [--perl name] [--flex name] [--bison name] [--make name] 
          [--dot name] [--platform target] [--prefix dir] [--docdir dir] 
130 131
          [--install name] [--english-only] [--enable-langs list] 
          [--with-sqlite3] [--with-libclang]
Dimitri van Heesch's avatar
Dimitri van Heesch committed
132
          [--with-doxywizard] [--with-doxysearch] [--with-doxyapp]
133

134
Options: 
135

136 137 138 139 140 141 142
  --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]
143 144 145 146
  --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]
147 148
  --make name           Use \`name' as the name of the GNU make tool
		        [default: autodetect]
149 150 151
  --dot name            Use \`name' as the name of the dot tool that
                        is part of the Graphviz package.
                        [default: autodetect]
152 153
  --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
154 155
  --prefix dir          Installation prefix directory (doxygen will be
                        put in PREFIX/bin/doxygen)
156
                        [default: $f_prefix]
Dimitri van Heesch's avatar
Dimitri van Heesch committed
157 158
  --docdir dir          Documentation is installed in DOCDIR/
                        [default: PREFIX/share/doc/packages/doxygen]
159
  --install name        Use \`name' as the name of the GNU install tool
160
                        [default: autodetect]
161
  --english-only        Include support for English only.
162 163
  --enable-langs list 	Include support for output languages listed in list.
  			[default: $f_langs]
164
  --with-sqlite3        Add support for sqlite3 output [experimental]
165
  --with-libclang       Add support for libclang parsing
166
  --with-doxywizard     Build the GUI frontend for doxygen. This
167
                        requires Qt version 4.
Dimitri van Heesch's avatar
Dimitri van Heesch committed
168 169
  --with-doxysearch     Build external search tools (doxysearch and doxyindexer)
                        requires Xapian library version 1.2
170
  --with-doxyapp        Example showing how to embed doxygen in an application.
171

172 173 174 175 176 177 178 179 180 181 182 183 184 185 186
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
187 188 189
    BeOS*)
      f_platform=beos-g++
      ;;
190 191 192
    dgux:*)
      f_platform=dgux-g++
      ;;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
193 194
    Darwin:*)
      f_platform=macosx-c++
195 196 197
      if test "$f_insttool" = NO; then
        f_insttool=/usr/bin/install
      fi
Dimitri van Heesch's avatar
Dimitri van Heesch committed
198
      ;;
199 200
    FreeBSD:*)
      f_platform=freebsd-g++
201 202 203
      if test "$f_insttool" = NO; then
        f_insttool=/usr/bin/install
      fi
204
      ;;
205 206 207 208 209 210
    NetBSD:*)
      f_platform=netbsd-g++
      if test "$f_insttool" = NO; then
        f_insttool=/usr/bin/install
      fi
      ;;
211 212
    HP-UX:*)
      f_platform=hpux-g++
213 214 215
      if test "$f_insttool" = NO; then
        f_insttool=/usr/bin/install
      fi
216 217 218 219 220 221 222
      ;;
    IRIX64:*)
      f_platform=irix-64
      ;;
    IRIX:*)
      f_platform=irix-n32
      ;;
223
    Linux:*|GNU:*|GNU/*:*)
224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244
      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*)
245
      f_platform=solaris-g++
246 247 248
      if test "$f_insttool" = NO; then
        f_insttool=/usr/bin/install
      fi
249 250 251 252 253 254 255
      ;;
    ULTRIX:*)
      f_platform=ultrix-g++
      ;;
    UNIX_SV:4.2*)
      f_platform=unixware-g++
      ;;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
256
    Cygwin:*|CYGWIN*)
257 258
      f_platform=win32-g++
      ;;
259 260 261
    *MiNT:*)
      f_platform=m68k-atari-mint-g++
      ;;
262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278
    *)
    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
279
if test -z "$f_docdir"; then
280
  f_docdir='$(INSTALL)/share/doc/packages/doxygen'
Dimitri van Heesch's avatar
Dimitri van Heesch committed
281 282
fi

283
if test "$f_plf_auto" = NO; then
284
  printf "  Checking for platform $f_platform... "
285 286 287 288 289 290 291 292 293
  if test '!' -d tmake/lib/$f_platform; then
    echo "not supported!" 
    echo
    exit 2
  fi
  echo "supported"
fi

#- check for qt --------------------------------------------------------------
294 295
 
if test "$f_wizard" = YES; then
296 297
  if test -z "$QTDIR"; then
    echo "  QTDIR environment variable not set!"
298
    printf "  Checking for Qt..."
Dimitri van Heesch's avatar
Dimitri van Heesch committed
299
    for d in /usr/{lib,share,qt}/{qt-4,qt4,qt,qt*,4} /usr; do
300
      if test -x "$d/bin/qmake"; then
301
        QTDIR=$d
302
      fi
303 304 305
    done
  else
    echo "  Detected Qt via the QTDIR environment variable..."
306
    printf "                    "
307
  fi
308
  if test -z "$QTDIR"; then
309
    echo "QTDIR not set and Qt not found at standard locations!"
310
    echo
311
    echo "Set the QTDIR environment variable such that \$QTDIR/bin/qmake exists."
Dimitri van Heesch's avatar
Dimitri van Heesch committed
312
    echo "check the Qt installation instructions!"
313 314 315
    exit 2
  fi
fi
Dimitri van Heesch's avatar
Dimitri van Heesch committed
316 317 318 319 320

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

if test "$f_search" = YES; then
  if test -z "$XAPIAN"; then
321
    printf "  Checking for Xapian..."
Dimitri van Heesch's avatar
Dimitri van Heesch committed
322 323 324 325 326 327 328 329 330 331 332
    for d in /usr /usr/local /opt/local; do
      if test -e "$d/include/xapian.h"; then
        XAPIAN=$d
      fi
    done
  fi
  if test -z "$XAPIAN"; then
    echo "XAPIAN not set and xapian.h not found at standard locations!"
    exit 2;
  fi
fi
333
   
334 335
# - check for make ------------------------------------------------------------

336
printf "  Checking for GNU make tool... "
337
if test "$f_make" = NO; then
338
  make_names="gmake make"
339
  make_dirs="$bin_dirs /usr/bin /usr/local/bin /bin /sbin"
340 341 342 343
  make_prog=NO
  for i in $make_names; do
    for j in $make_dirs; do
      if test -x "$j/$i"; then
344 345 346 347
        if test -n "`$j/$i --version 2>/dev/null | grep GNU`"; then
          make_prog="$j/$i"
          break 2
        fi
348 349 350 351 352 353 354 355 356 357 358 359 360
      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"

361 362
# - check for install ------------------------------------------------------------

363
printf "  Checking for GNU install tool... "
364 365
if test "$f_insttool" = NO; then
  install_names="ginstall install"
366
  install_dirs="$bin_dirs /usr/bin /usr/local/bin /bin /sbin /usr/ucb"
367 368 369 370 371
  install_prog=NO
  install_found=NO
  for i in $install_names; do
    for j in $install_dirs; do
      if test -x "$j/$i"; then
372
        if test -n "`$j/$i --version 2>/dev/null | grep utils`"; then
373 374 375 376
          install_found=YES
          install_prog="$j/$i"
          break 2
        fi
377 378 379 380 381 382 383 384
      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
385
    echo;
386 387
  else
    echo "not found!";
Dimitri van Heesch's avatar
Dimitri van Heesch committed
388
    echo
389
  fi
390
  echo "GNU version of install is required: this is part of the fileutils/coreutils package: "
Dimitri van Heesch's avatar
Dimitri van Heesch committed
391
  echo "see http://www.gnu.org/software/fileutils/fileutils.html"
392 393 394 395 396 397
  echo
  exit 2
fi
echo "using $f_insttool";


398 399
# - check for dot ------------------------------------------------------------

400
printf "  Checking for dot (part of GraphViz)... "
401
if test "$f_dot" = NO; then
402
  dot_dirs="$bin_dirs /usr/bin /usr/local/bin /bin /sbin"
403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418
  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

419 420 421
# - check for sqlite3 ---------------------------------------------------------

if test "$f_sqlite3" = YES; then
422
  printf "  Checking for sqlite3 ... "
423
  sqlite3_hdr_dir="/usr/include /usr/local/include /opt/local/include"
424
  sqlite3_lib_dir="/usr/lib /usr/local/lib /opt/local/lib /usr/lib/x86_64-linux-gnu"
425 426 427 428 429 430 431 432 433 434 435 436 437
  sqlite3_lib_name="libsqlite3.so libsqlite3.dylib libsqlite3.a"
  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
438
        if test -e "$i/$j"; then
439 440 441 442 443 444 445 446 447
          sqlite3_lib="$i/$j"
          sqlite3_link="-L $i -lsqlite3"
          break
        fi
      done
    fi
  done
  if test "$sqlite3_hdr" = NO -o "$sqlite3_lib" = NO; then
    echo "not found!";
448
    exit 1
449 450 451 452 453
  else
    echo "using header $sqlite3_hdr and library $sqlite3_lib...";
  fi
fi

454 455 456 457 458 459
# - check for libclang ---------------------------------------------------------

if test "$f_libclang" = YES; then
  printf "  Checking for libclang ... "
  libclang_hdr_dir="/usr/include /usr/local/include /opt/local/include"
  libclang_lib_dir="/usr/lib /usr/local/lib /opt/local/lib"
460 461 462 463 464
  if test "$f_libclangstatic" = NO; then
    libclang_lib_name="libclang.so libclang.dylib libclang.a"
  else
    libclang_lib_name="libclang.a"
  fi
465 466 467 468 469 470 471 472 473 474 475 476 477 478
  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"
479 480 481
          if test "$f_libclangstatic" = NO; then
            libclang_link="-L $i -lclang"
          else
Dimitri van Heesch's avatar
Dimitri van Heesch committed
482
            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"
483
          fi
484 485 486 487 488 489 490 491 492 493 494
          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
495

496 497
# - check for perl ------------------------------------------------------------

498
printf "  Checking for perl... "
499 500
if test "$f_perl" = NO; then
  perl_names="perl perl5"
501
  perl_dirs="$bin_dirs /usr/bin /usr/local/bin /bin /sbin"
502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528
  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";

529 530
# - check for flex ------------------------------------------------------------

531
printf "  Checking for flex... "
532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554
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 ------------------------------------------------------------

555
printf "  Checking for bison... "
556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575
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
576

577 578
# -----------------------------------------------------------------------------

579 580 581 582 583
#
# Make VERSION file
#
echo "  Creating VERSION file."
# Output should be something like 1.4.5-20051010
Dimitri van Heesch's avatar
Dimitri van Heesch committed
584
if test "x$doxygen_version_mmn" = "xNO"; then
585 586 587 588 589
  echo "$doxygen_version_major.$doxygen_version_minor.$doxygen_version_revision" > VERSION
else
  echo "$doxygen_version_major.$doxygen_version_minor.$doxygen_version_revision-$doxygen_version_mmn" > VERSION
fi

590 591 592
test -f .makeconfig && rm .makeconfig
test -f .tmakeconfig && rm .tmakeconfig

593
configPWD=`pwd`
594

595
cat > .makeconfig <<EOF
596 597
DOXYGEN   = $configPWD
TMAKEPATH = $configPWD/tmake/lib/$f_platform
598
ENV       = env TMAKEPATH="\$(TMAKEPATH)"
599
TMAKE     = $configPWD/tmake/bin/tmake
600 601 602
MAKE      = $f_make
PERL      = $f_perl
RM        = rm -f
603
CP        = cp
604
VERSION   = `cat VERSION`
605 606
INSTALL   = $f_prefix
INSTTOOL  = $f_insttool
607
DOXYDOCS  = ..
Dimitri van Heesch's avatar
Dimitri van Heesch committed
608
DOCDIR    = $f_docdir
609
QTDIR     = $QTDIR
610 611
EOF

612 613 614 615 616 617
if test "$f_dot" != NO; then
  cat >> .makeconfig <<EOF
HAVE_DOT  = $f_dot
EOF
fi

618

619 620 621 622 623 624
if test "$f_platform" = "m68k-atari-mint-g++"; then
  cat >> .makeconfig <<EOF
TMAKE += -unix
EOF
fi

625 626 627 628 629 630 631 632 633
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
634
fi
635

636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651
# 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

652
cat spec.tmp ./packages/rpm/doxygen.spec.in > ./packages/rpm/doxygen.spec
653 654 655 656 657 658

rm -f spec.tmp


# make .tmakeconfig
#
659 660
touch .tmakeconfig
if test "$f_shared" = NO; then
661
  if test "$f_platform" = "osf1-cxx" -o "$f_platform" = "irix-n32"; then
662
  cat >> .tmakeconfig <<EOF
Dimitri van Heesch's avatar
Dimitri van Heesch committed
663
    TMAKE_LFLAGS += -non_shared
664
EOF
Dimitri van Heesch's avatar
Dimitri van Heesch committed
665
  elif test "$f_platform" = "solaris-cc"; then
666
  cat >> .tmakeconfig <<EOF
Dimitri van Heesch's avatar
Dimitri van Heesch committed
667
    TMAKE_LFLAGS += -Bstatic
Dimitri van Heesch's avatar
Dimitri van Heesch committed
668 669 670
EOF
  elif test "$f_platform" = "hpux-cc"; then
  cat >> .tmakeconfig <<EOF
Dimitri van Heesch's avatar
Dimitri van Heesch committed
671
    TMAKE_LFLAGS += -noshared
672
EOF
673 674
  else
  cat >> .tmakeconfig <<EOF
Dimitri van Heesch's avatar
Dimitri van Heesch committed
675
    TMAKE_LFLAGS += -static
676 677
EOF
  fi
678
fi
679
if test "$f_platform" = "hpux-g++" -o "$f_platform" = "linux-g++"; then
680 681 682 683
  cat >> .tmakeconfig <<EOF
    TMAKE_CXXFLAGS += -D_LARGEFILE_SOURCE
EOF
fi
684
if test "$f_platform" = "macosx-uni-c++"; then
685
  if test -n "`ls /Developer/SDKs/MacOSX10.*.sdk 2>/dev/null`"; then
686 687
    mac_sdk=MacOSX10.4u.sdk
  fi
688
  if test -n "`ls /Developer/SDKs/MacOSX10.5*.sdk 2>/dev/null`"; then
689 690 691 692 693 694 695 696 697 698
    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
699 700 701 702 703 704
if test "$f_wizard" = YES; then
  cat >> .tmakeconfig <<EOF
TMAKE_MOC = $QTDIR/bin/moc
EOF
fi

705
if test "$f_english" = YES; then
706
  cat >> .tmakeconfig <<EOF
Dimitri van Heesch's avatar
Dimitri van Heesch committed
707
TMAKE_CXXFLAGS += -DENGLISH_ONLY
708 709 710
EOF
fi

Dimitri van Heesch's avatar
Dimitri van Heesch committed
711 712 713 714 715 716 717 718
if test "$f_search" = YES; then
  cat >> .tmakeconfig <<EOF
LIBS += -L$XAPIAN/lib
INCLUDEPATH += $XAPIAN/include
EOF
fi

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"
719 720

for i in $f_inmakefiles ; do
721 722 723 724 725 726 727 728 729
     SRC=$i
     DST=`echo $i|sed 's%\(.*\).in$%\1%'`
     TIME=`date`
     cat > $DST <<EOF
#
# This file was generated from `basename $i` on $TIME
#

EOF
730
     cat .makeconfig >> $DST
731
     if test $i = Makefile.in; then
732
       echo "" >> $DST
Dimitri van Heesch's avatar
Dimitri van Heesch committed
733 734 735 736
       EXTRADEPS=
       if test $f_wizard = YES; then
         EXTRADEPS=doxywizard
       fi
Dimitri van Heesch's avatar
Dimitri van Heesch committed
737 738 739
#       if test $f_search = YES; then
#         EXTRADEPS="$EXTRADEPS doxysearch"
#       fi
Dimitri van Heesch's avatar
Dimitri van Heesch committed
740
       echo "all: src/version.cpp $EXTRADEPS" >> $DST
741
       echo "	\$(MAKE) -C qtools" >> $DST
742
       echo "	\$(MAKE) -C libmd5" >> $DST
743
       echo "	\$(MAKE) -C src" >> $DST
744
       if test $f_wizard = YES; then
Dimitri van Heesch's avatar
Dimitri van Heesch committed
745
         echo "	\$(MAKE) MAN1DIR=\$(MAN1DIR) -C addon/doxywizard" >> $DST
746
       fi
Dimitri van Heesch's avatar
Dimitri van Heesch committed
747 748 749
       if test $f_search = YES; then
         echo "	\$(MAKE) -C addon/doxysearch" >> $DST
       fi
750 751 752
       if test $f_app = YES; then
         echo "	\$(MAKE) -C addon/doxyapp" >> $DST
       fi
753
       echo "" >> $DST
754 755
       echo "doxywizard_install:" >> $DST
       if test $f_wizard = YES; then
Dimitri van Heesch's avatar
Dimitri van Heesch committed
756
         echo "	\$(MAKE) MAN1DIR=\$(MAN1DIR) -C addon/doxywizard install" >> $DST
757
       fi
Dimitri van Heesch's avatar
Dimitri van Heesch committed
758 759 760 761
       echo "doxysearch_install:" >> $DST
       if test $f_search = YES; then
         echo "	\$(MAKE) MAN1DIR=\$(MAN1DIR) -C addon/doxysearch install" >> $DST
       fi
762
       echo "" >> $DST
763
     fi
764 765 766 767 768
     if test $f_wizard = YES; then
       sed -e "s/%%WITHDOXYWIZARD%% /--with doxywizard /g" $SRC >> $DST
     else
       sed -e "s/%%WITHDOXYWIZARD%% //g" $SRC >> $DST
     fi
769 770 771
     echo "  Created $DST from $SRC..."
done

772 773 774
cat src/libdoxycfg.t.in | sed -e "s|%%FLEX%%|$f_flex|g" -e "s|%%BISON%%|$f_bison|g" > src/libdoxycfg.t
cat src/libdoxygen.t.in | sed -e "s|%%FLEX%%|$f_flex|g" -e "s|%%BISON%%|$f_bison|g" > src/libdoxygen.t

Dimitri van Heesch's avatar
Dimitri van Heesch committed
775
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" 
776 777

for i in $f_inprofiles ; do
778 779 780 781 782 783 784 785 786 787
     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
788
       realopts="release"
789
     else
790 791
       realopts="debug"
     fi
792 793 794
     #if test "$f_thread" = YES; then
     #  realopts="$realopts thread"
     #fi
795
     cat $SRC .tmakeconfig | sed -e "s/\$extraopts/$realopts/g" -e "s;%%SQLITE3_LIBS%%;$sqlite3_link;g" -e "s;%%LIBCLANG_LIBS%%;$libclang_link;g" >> $DST
796 797 798
     echo "  Created $DST from $SRC..."
done

799 800
# - generating src/lang_cfg.h 

801
if test -f "src/lang_cfg.h"; then
802 803
    chmod u+w src/lang_cfg.h   # make sure file can be overwritten
fi
804
echo "  Generating src/lang_cfg.h..."
805 806
echo $f_langs | $f_perl -e '@l=split(/,/,<STDIN>); 
        chomp @l; 
807
	@allowed=(split(/,/,"NL,SV,CZ,FR,ID,IT,DE,JP,JE,ES,FI,RU,HR,PL,PT,HU,KR,KE,RO,SI,CN,NO,MK,BR,DK,SK,UA,GR,TW,SR,CA,LT,ZA,AR,FA,SC,VI,TR,EO,AM"));
808 809 810 811 812 813 814 815 816
	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   
817 818 819 820 821 822 823

if test -f "src/config.h"; then
    chmod u+w src/config.h
fi
echo "  Generating src/settings.h..."
echo "#ifndef SETTINGS_H" > src/settings.h
echo "#define SETTINGS_H" >> src/settings.h
824
echo "" >> src/settings.h
825
if test "$f_sqlite3" != NO; then
826
echo "#define USE_SQLITE3  1" >> src/settings.h
827
else
828
echo "#define USE_SQLITE3  0" >> src/settings.h
829
fi
830 831 832 833 834 835 836 837 838 839 840
if test "$f_libclang" != NO; then
echo "#define USE_LIBCLANG 1" >> src/settings.h
else
echo "#define USE_LIBCLANG 0" >> src/settings.h
fi
echo "" >> src/settings.h
echo "#define IS_SUPPORTED(x) \\" >> src/settings.h
echo "  ((USE_SQLITE3  && strcmp(\"USE_SQLITE3\",(x))==0)  || \\" >> src/settings.h 
echo "   (USE_LIBCLANG && strcmp(\"USE_LIBCLANG\",(x))==0) || \\" >> src/settings.h 
echo "  0)" >> src/settings.h 
echo "" >> src/settings.h
841
echo "#endif" >> src/settings.h
842
echo