summaryrefslogtreecommitdiffstats
path: root/configure
blob: 5054923fa71d7dae4872c1f844b88a16949bb6aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
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
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
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
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
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
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
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
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
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
669
670
671
#!/bin/sh
#
# $Id$
#
# Copyright (C) 1997-2011 by Dimitri van Heesch.
# 
# 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.
# 
# Documents produced by Doxygen are derivative works derived from the
# input used in their production; they are not affected by this license.
# 
# shell script to configure doxygen

doxygen_version_major=1
doxygen_version_minor=7
doxygen_version_revision=4

#NOTE: Setting version_mmn to "NO" will omit mmn info from the package.
doxygen_version_mmn=20110426

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

f_debug=NO
f_shared=YES
f_make=NO
f_dot=NO
f_perl=NO
f_plf_auto=NO
f_prefix=/usr/local
f_insttool=NO
f_english=NO
f_wizard=NO
f_app=NO
f_thread=NO
f_flex=NO
f_bison=NO
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

while test -n "$1";  do
  case $1 in
    --prefix | -prefix)
       shift; f_prefix=$1
       ;;
    --docdir | -docdir)
       shift; f_docdir=$1
       ;;
    --shared | -shared)
       f_shared=YES
       ;;
    --static | -static)
       f_shared=NO
       ;;
    --release | -release)
       f_debug=NO
       ;;
    --debug | -debug)
       f_debug=YES
       ;;
    --english-only | -english-only)
       f_english=YES
       ;;
    --enable-langs | -enable-langs)
       shift; f_langs=$1
       ;;
    --platform | -platform)
       shift; f_platform=$1
       ;;
    --make | -make)
       shift; f_make=$1
       ;;
    --dot | -dot)
       shift; f_dot=$1
       ;;
    --perl | -perl)
       shift; f_perl=$1
       ;;
    --flex | -flex)
       shift; f_flex=$1
       ;;
    --bison | -bison)
       shift; f_bison=$1
       ;;
    --install | -install)
       shift; f_insttool=$1
       ;;
    --with-doxywizard | -with-doxywizard)
       f_wizard=YES
       ;;
    --with-doxyapp | -with-doxyapp)
       f_app=YES
       ;;
    -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] 
          [--perl name] [--flex name] [--bison name] [--make name] 
          [--dot name] [--platform target] [--prefix dir] [--docdir dir] 
          [--install name] [--english-only] [----enable-langs list] 
          [--with-doxywizard] [--with-doxyapp]

Options: 

  --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]
  --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]
  --make name           Use \`name' as the name of the GNU make tool
		        [default: autodetect]
  --dot name            Use \`name' as the name of the dot tool that
                        is part of the Graphviz package.
                        [default: autodetect]
  --platform target     Do not detect platform but use \`target' instead.
                        See PLATFORMS for a list of possibilities
  --prefix dir          Installation prefix directory (doxygen will be
                        put in PREFIX/bin/doxygen)
                        [default: $f_prefix]
  --docdir dir          Documentation is installed in DOCDIR/
                        [default: PREFIX/share/doc/packages/doxygen]
  --install name        Use \`name' as the name of the GNU install tool
                        [default: autodetect]
  --english-only        Include support for English only.
  --enable-langs list 	Include support for output languages listed in list.
  			[default: $f_langs]
  --with-doxywizard     Build the GUI frontend for doxygen. This
                        requires Qt 3.3.x
  --with-doxyapp        Example showing how to embed doxygen in an application.

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
      ;;
    BeOS*)
      f_platform=beos-g++
      ;;
    dgux:*)
      f_platform=dgux-g++
      ;;
    Darwin:*)
      f_platform=macosx-c++
      if test "$f_insttool" = NO; then
        f_insttool=/usr/bin/install
      fi
      ;;
    FreeBSD:*)
      f_platform=freebsd-g++
      if test "$f_insttool" = NO; then
        f_insttool=/usr/bin/install
      fi
      ;;
    HP-UX:*)
      f_platform=hpux-g++
      if test "$f_insttool" = NO; then
        f_insttool=/usr/bin/install
      fi
      ;;
    IRIX64:*)
      f_platform=irix-64
      ;;
    IRIX:*)
      f_platform=irix-n32
      ;;
    Linux:*|GNU:*|GNU/*:*)
      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-g++
      if test "$f_insttool" = NO; then
        f_insttool=/usr/bin/install
      fi
      ;;
    ULTRIX:*)
      f_platform=ultrix-g++
      ;;
    UNIX_SV:4.2*)
      f_platform=unixware-g++
      ;;
    Cygwin:*|CYGWIN*)
      f_platform=win32-g++
      ;;
    *MiNT:*)
      f_platform=m68k-atari-mint-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 -z "$f_docdir"; then
  f_docdir='$(INSTALL)/share/doc/packages/doxygen'
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 --------------------------------------------------------------
 
if test "$f_wizard" = YES; then
  if test -z "$QTDIR"; then
    echo "  QTDIR environment variable not set!"
    echo -n "  Checking for Qt..."
    for d in /usr/{lib,share,qt}/{qt-4,qt4,qt,qt*,4} /usr; do
      if test -x "$d/bin/qmake"; then
        QTDIR=$d
      fi
    done
  else
    echo "  Detected Qt via the QTDIR environment variable..."
    echo -n "                    "
  fi
  if test -z "$QTDIR"; then
    echo "QTDIR not set and Qt not found at standard locations!"
    echo
    echo "Set the QTDIR environment variable such that \$QTDIR/bin/qmake exists."
    echo "check the Qt installation instructions!"
    exit 2
  fi
fi
   
# - check for make ------------------------------------------------------------

echo -n "  Checking for GNU make tool... "
if test "$f_make" = NO; then
  make_names="gmake make"
  make_dirs="$bin_dirs /usr/bin /usr/local/bin /bin /sbin"
  make_prog=NO
  for i in $make_names; do
    for j in $make_dirs; do
      if test -x "$j/$i"; then
        if test -n "`$j/$i --version 2>/dev/null | grep GNU`"; then
          make_prog="$j/$i"
          break 2
        fi
      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"

# - check for install ------------------------------------------------------------

echo -n "  Checking for GNU install tool... "
if test "$f_insttool" = NO; then
  install_names="ginstall install"
  install_dirs="$bin_dirs /usr/bin /usr/local/bin /bin /sbin /usr/ucb"
  install_prog=NO
  install_found=NO
  for i in $install_names; do
    for j in $install_dirs; do
      if test -x "$j/$i"; then
        if test -n "`$j/$i --version 2>/dev/null | grep utils`"; then
          install_found=YES
          install_prog="$j/$i"
          break 2
        fi
      fi
    done
  done
  f_insttool="$install_prog" 
fi

if test "$f_insttool" = NO; then
  if test "$install_found" = YES; then
    echo;
  else
    echo "not found!";
    echo
  fi
  echo "GNU version of install is required: this is part of the fileutils/coreutils package: "
  echo "see http://www.gnu.org/software/fileutils/fileutils.html"
  echo
  exit 2
fi
echo "using $f_insttool";


# - check for dot ------------------------------------------------------------

echo -n "  Checking for dot (part of GraphViz)... "
if test "$f_dot" = NO; then
  dot_dirs="$bin_dirs /usr/bin /usr/local/bin /bin /sbin"
  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

# - check for perl ------------------------------------------------------------

echo -n "  Checking for perl... "
if test "$f_perl" = NO; then
  perl_names="perl perl5"
  perl_dirs="$bin_dirs /usr/bin /usr/local/bin /bin /sbin"
  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";

# - check for flex ------------------------------------------------------------

echo -n "  Checking for flex... "
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 ------------------------------------------------------------

echo -n "  Checking for bison... "
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

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

#
# Make VERSION file
#
echo "  Creating VERSION file."
# Output should be something like 1.4.5-20051010
if test "x$doxygen_version_mmn" = "xNO"; then
  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

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

configPWD=`pwd`

cat > .makeconfig <<EOF
DOXYGEN   = $configPWD
TMAKEPATH = $configPWD/tmake/lib/$f_platform
ENV       = env TMAKEPATH=\$(TMAKEPATH)
TMAKE     = $configPWD/tmake/bin/tmake
MAKE      = $f_make
PERL      = $f_perl
RM        = rm -f
CP        = cp
VERSION   = `cat VERSION`
INSTALL   = $f_prefix
INSTTOOL  = $f_insttool
DOXYDOCS  = ..
DOCDIR    = $f_docdir
QTDIR     = $QTDIR
EOF

if test "$f_dot" != NO; then
  cat >> .makeconfig <<EOF
HAVE_DOT  = $f_dot
EOF
fi

if test "$f_platform" = "m68k-atari-mint-g++"; then
  cat >> .makeconfig <<EOF
TMAKE += -unix
EOF
fi

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
  fi


# 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

cat spec.tmp ./packages/rpm/doxygen.spec.in > ./packages/rpm/doxygen.spec

rm -f spec.tmp


# make .tmakeconfig
#
touch .tmakeconfig
if test "$f_shared" = NO; then
  if test "$f_platform" = "osf1-cxx" -o "$f_platform" = "irix-n32"; then
  cat >> .tmakeconfig <<EOF
    TMAKE_LFLAGS += -non_shared
EOF
  elif test "$f_platform" = "solaris-cc"; then
  cat >> .tmakeconfig <<EOF
    TMAKE_LFLAGS += -Bstatic
EOF
  elif test "$f_platform" = "hpux-cc"; then
  cat >> .tmakeconfig <<EOF
    TMAKE_LFLAGS += -noshared
EOF
  else
  cat >> .tmakeconfig <<EOF
    TMAKE_LFLAGS += -static
EOF
  fi
fi
if test "$f_platform" = "hpux-g++" -o "$f_platform" = "linux-g++"; then
  cat >> .tmakeconfig <<EOF
    TMAKE_CXXFLAGS += -D_LARGEFILE_SOURCE
EOF
fi
if test "$f_platform" = "macosx-uni-c++"; then
  if test -n "`ls /Developer/SDKs/MacOSX10.*.sdk 2>/dev/null`"; then
    mac_sdk=MacOSX10.4u.sdk
  fi
  if test -n "`ls /Developer/SDKs/MacOSX10.5*.sdk 2>/dev/null`"; then
    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
if test "$f_wizard" = YES; then
  cat >> .tmakeconfig <<EOF
TMAKE_MOC = $QTDIR/bin/moc
EOF
fi

if test "$f_english" = YES; then
  cat >> .tmakeconfig <<EOF
TMAKE_CXXFLAGS += -DENGLISH_ONLY
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"

for i in $f_inmakefiles ; do
     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 >> $DST
     if test $i = Makefile.in; then
       echo "" >> $DST
       echo "all: src/version.cpp " >> $DST
       echo "	\$(MAKE) -C qtools" >> $DST
       echo "	\$(MAKE) -C libmd5" >> $DST
       echo "	\$(MAKE) -C src" >> $DST
       if test $f_wizard = YES; then
         echo "	\$(MAKE) MAN1DIR=\$(MAN1DIR) -C addon/doxywizard" >> $DST
       fi
       if test $f_app = YES; then
         echo "	\$(MAKE) -C addon/doxyapp" >> $DST
       fi
       echo "" >> $DST
       echo "doxywizard_install:" >> $DST
       if test $f_wizard = YES; then
         echo "	\$(MAKE) MAN1DIR=\$(MAN1DIR) -C addon/doxywizard install" >> $DST
       fi
       echo "" >> $DST
     fi
     if test $f_wizard = YES; then
       sed -e "s/%%WITHDOXYWIZARD%% /--with doxywizard /g" $SRC >> $DST
     else
       sed -e "s/%%WITHDOXYWIZARD%% //g" $SRC >> $DST
     fi
     echo "  Created $DST from $SRC..."
done

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 libmd5/libmd5.pro.in addon/doxyapp/doxyapp.pro.in" 

for i in $f_inprofiles ; do
     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
       realopts="release"
     else
       realopts="debug"
     fi
     #if test "$f_thread" = YES; then
     #  realopts="$realopts thread"
     #fi
     cat $SRC .tmakeconfig | sed -e "s/\$extraopts/$realopts/g" >> $DST
     echo "  Created $DST from $SRC..."
done

# - generating src/lang_cfg.h 

if test -f "src/lang_cfg.h"; then
    chmod u+w src/lang_cfg.h   # make sure file can be overwritten
fi
echo -n "  Generating src/lang_cfg.h..."
echo $f_langs | $f_perl -e '@l=split(/,/,<STDIN>); 
        chomp @l; 
	@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"));
	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