This file is indexed.

/usr/bin/root-config is in libroot-core-dev 5.34.00-2.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  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
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
#!/usr/bin/env bash
# -*- sh-indentation: 3 -*-
# This script returns the machine dependent compile options needed
# to compile and link applications using the ROOT libraries.
#
# Author: Fons Rademakers, 06/06/99

readlink=readlink
if [ `uname` = "AIX" ]; then
   readlink=echo
fi

# work around readlink versions not having -f option
fullpath1=`$readlink $0`
if [ "$?" -ne "0" ]; then
   fullpath1=$0
else
   if [ ${fullpath1##/} = $fullpath1 ] && [ ${fullpath1##~} = $fullpath1 ]; then
      # relative path, prepend directory where executable was found
      lpath=`dirname $0`
      fullpath1=$lpath/$fullpath1
   fi
fi
progdir=`dirname $fullpath1`
runningdir=`pwd`
if [ ${progdir##/} != $progdir ] || [ ${progdir##~} != $progdir ]; then
   # absolute path
   fullpath=$progdir
else
   # relative path
   if [ $progdir != "." ]; then
      fullpath=$runningdir/$progdir
   else
      fullpath=$runningdir
   fi
fi
# work around readlink versions not having -f option
fullpath1=`$readlink $fullpath`
if [ "$?" -ne "0" ]; then
   fullpath1=$fullpath
fi
ROOTSYS=`dirname $fullpath1`

arch=linuxx8664gcc
platform=linux
bindir=/usr/bin
libdir=/usr/lib/x86_64-linux-gnu
incdir=/usr/include/root
etcdir=/etc/root
features="asimage astiff bonjour builtin_afterimage builtin_lzma cintex clarens explicitlink fftw3 gviz gdml genvector globus gsl_shared krb5 ldap mathmore memstat minuit2 mysql odbc opengl peac pgsql pythia8 python qt qtgsi reflex roofit ruby shadowpw shared soversion ssl table tmva unuran x11 xft xml thread"
configargs="--prefix=/usr --mandir=/usr/share/man/man1 --docdir=/usr/share/doc/root --cintincdir=/usr/lib/x86_64-linux-gnu --etcdir=/etc/root --with-sys-iconpath=/usr/share/pixmaps --libdir=/usr/lib/x86_64-linux-gnu/root5.34 --enable-bonjour --enable-cintex --enable-clarens --enable-editline --enable-explicitlink --enable-gdml --enable-globus --enable-gsl-shared --enable-gviz --enable-fftw3 --enable-krb5 --enable-ldap --enable-qt --enable-qtgsi --enable-mathcore --enable-mathmore --enable-memstat --enable-minuit2 --enable-mysql --enable-peac --enable-pgsql --enable-pythia8 --enable-odbc --enable-reflex --enable-roofit --enable-ruby --enable-shadowpw --enable-shared --enable-soversion --enable-table --disable-rpath --disable-afs --disable-srp --disable-builtin-afterimage --disable-builtin-ftgl --disable-builtin-freetype --disable-builtin-glew --disable-builtin-pcre --disable-builtin-zlib --disable-alien --disable-chirp --disable-dcache --disable-gfal --disable-monalisa --disable-oracle --disable-pythia6 --disable-rfio --disable-sapdb --fail-on-missing --with-globus=/usr --with-globus-incdir=/usr/include/globus --with-globus-libdir=/usr/lib --with-ruby-incdir=/usr/include/ruby-1.9.1 --with-pythia8-incdir=/usr/include/pythia8 --enable-unuran --disable-xrootd"
altcc="gcc"
altcxx="g++"
altf77="gfortran"
altld="g++"
dicttype=cint

if test "$platform" = "win32"; then
   if [ "x$ROOTSYS" != "x" ]; then
      unixROOTSYS=`cygpath -u $ROOTSYS`
   else
      unixROOTSYS=.
   fi
   bindir=$unixROOTSYS/bin
   libdir=$unixROOTSYS/lib
   incdir=$unixROOTSYS/include
   etcdir=$unixROOTSYS/etc
fi

### ROOT libraries ###

if test "$platform" = "ios"; then
   newlib=
   rootglibs=
   rootevelibs=
   rootlibs="-lRoota"
else
   newlib="-lNew"
   rootglibs="-lGui"
   rootevelibs="-lEve -lEG -lTreePlayer -lGeom -lGed -lRGL"
   rootlibs="-lCore -lCint -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad \
             -lTree -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread"
   if test "$dicttype" = "reflex" || test "$dicttype" = "gccxml"; then
       rootlibs="$rootlibs -lReflex"
   fi
fi

if test "$platform" = "win32"; then
   rootulibs="-include:_G__cpp_setupG__Net        \
              -include:_G__cpp_setupG__IO         \
              -include:_G__cpp_setupG__Hist       \
              -include:_G__cpp_setupG__Graf       \
              -include:_G__cpp_setupG__G3D        \
              -include:_G__cpp_setupG__GPad       \
              -include:_G__cpp_setupG__Tree       \
              -include:_G__cpp_setupG__Thread     \
              -include:_G__cpp_setupG__Rint       \
              -include:_G__cpp_setupG__PostScript \
              -include:_G__cpp_setupG__Matrix     \
              -include:_G__cpp_setupG__Physics"
   rootuglibs="-include:_G__cpp_setupG__Gui1"
   rootuevelibs="-include:_G__cpp_setupG__EG         \
                 -include:_G__cpp_setupG__TreePlayer \
                 -include:_G__cpp_setupG__Geom1      \
                 -include:_G__cpp_setupG__Ged        \
                 -include:_G__cpp_setupG__GL         \
                 -include:_G__cpp_setupG__Eve1"
elif test "$platform" = "aix5"; then
   rootulibs="-Wl,-u,.G__cpp_setupG__Net        \
              -Wl,-u,.G__cpp_setupG__IO         \
              -Wl,-u,.G__cpp_setupG__Hist       \
              -Wl,-u,.G__cpp_setupG__Graf       \
              -Wl,-u,.G__cpp_setupG__G3D        \
              -Wl,-u,.G__cpp_setupG__GPad       \
              -Wl,-u,.G__cpp_setupG__Tree       \
              -Wl,-u,.G__cpp_setupG__Thread     \
              -Wl,-u,.G__cpp_setupG__Rint       \
              -Wl,-u,.G__cpp_setupG__PostScript \
              -Wl,-u,.G__cpp_setupG__Matrix     \
              -Wl,-u,.G__cpp_setupG__Physics"
   rootuglibs="-Wl,-u,.G__cpp_setupG__Gui1"
   rootuevelibs="-Wl,-u,.G__cpp_setupG__EG         \
                 -Wl,-u,.G__cpp_setupG__TreePlayer \
                 -Wl,-u,.G__cpp_setupG__Geom1      \
                 -Wl,-u,.G__cpp_setupG__Ged        \
                 -Wl,-u,.G__cpp_setupG__GL         \
                 -Wl,-u,.G__cpp_setupG__Eve1"
else
   rootulibs="-Wl,-u,_G__cpp_setupG__Net        \
              -Wl,-u,_G__cpp_setupG__IO         \
              -Wl,-u,_G__cpp_setupG__Hist       \
              -Wl,-u,_G__cpp_setupG__Graf       \
              -Wl,-u,_G__cpp_setupG__G3D        \
              -Wl,-u,_G__cpp_setupG__GPad       \
              -Wl,-u,_G__cpp_setupG__Tree       \
              -Wl,-u,_G__cpp_setupG__Thread     \
              -Wl,-u,_G__cpp_setupG__Rint       \
              -Wl,-u,_G__cpp_setupG__PostScript \
              -Wl,-u,_G__cpp_setupG__Matrix     \
              -Wl,-u,_G__cpp_setupG__Physics"
   rootuglibs="-Wl,-u,_G__cpp_setupG__Gui1"
   rootuevelibs="-Wl,-u,_G__cpp_setupG__EG         \
                 -Wl,-u,_G__cpp_setupG__TreePlayer \
                 -Wl,-u,_G__cpp_setupG__Geom1      \
                 -Wl,-u,_G__cpp_setupG__Ged        \
                 -Wl,-u,_G__cpp_setupG__GL         \
                 -Wl,-u,_G__cpp_setupG__Eve1"
fi

### machine dependent settings ###

case $arch in
hpux)
   #HP-UX with CC
   auxcflags="+a1 +Z"
   auxlibs="-lm -ldld"
   ;;
hpuxacc | hpuxia64acc)
   # HP-UX 10.x with aCC
   auxcflags=
   auxlibs="-lm -ldld"
   ;;
hpuxgcc)
   # HP-UX 10.x with g++
   auxcflags=
   auxlibs="-lm -ldld"
   ;;
hurddeb)
   # Debian GNU/Hurd
   auxcflags=
   auxlibs="-lnsl -lm -ldl -rdynamic"
   ;;
aix5)
   # IBM AIX
   auxcflags="-qnoro -qnoroconst -qmaxmem=-1 -qrtti=all"
   auxlibs=
   #forcelibs=$rootulibs
   #forceglibs=$rootuglibs
   #forceevelibs=$rootuevelibs
   ;;
aixgcc)
   # IBM AIX with g++
   auxcflags="-fsigned-char"
   auxlibs=
   #forcelibs=$rootulibs
   #forceglibs=$rootuglibs
   #forceevelibs=$rootuevelibs
   ;;
solaris)
   # Solaris
   auxcflags=
   auxlibs="-L/usr/ccs/lib -lm -lsocket -lgen -ldl -lsunmath"
   ;;
solarisgcc)
   # Solaris g++ 2.8.x
   auxcflags=
   auxlibs="-L/usr/ccs/lib -lm -lsocket -lgen -ldl"
   ;;
solarisCC5)
   # Solaris CC 5.0
   if [ `uname -p` = "i386" ]; then
      auxcflags="-library=stlport4"
      auxldflags="-library=stlport4"
   else
      auxcflags=
      auxldflags=
   fi
   auxlibs="-lm -ldl -lnsl -lsocket"
   ;;
solaris64CC5)
   # Solaris CC 5.0 x86-64
   auxcflags="-m64 -library=stlport4"
   auxldflags="-m64 -library=stlport4"
   auxlibs="-lm -ldl -lnsl -lsocket"
   ;;
sgicc)
   # SGI
   auxcflags="-LANG:std"
   auxlibs="-lm -ldl"
   ;;
sgicc64)
   # SGI
   auxcflags="-64 -LANG:std"
   auxlibs="-lm"
   ;;
sgigcc)
   # SGI 6.x with gcc
   auxcflags="-fsigned-char"
   auxlibs="-lgen -lstdc++ -lm -ldl"
   ;;
sgin32gcc)
   # SGI 6.x with gcc with n32 ABI
   auxcflags="-fsigned-char"
   auxlibs="-lm -ldl"
   ;;
alphagcc)
   # Alpha/OSF with g++
   auxcflags=
   auxlibs="-lg++ -lm"
   ;;
alphagcc)
   # Alpha/OSF with gcc
   auxcflags="-mcpu=ev5 -D__osf__ -D__alpha"
   auxlibs="-ltermcap -lm"
   ;;
alphacxx6)
   # Alpha/OSF with cxx6
   auxcflags="-tlocal -D__osf__ -D__alpha -D_USE_STD_IOSTREAM"
   auxlibs="-lm"
   ;;
alphacxx)
   # Alpha/OSF with cxx5
   auxcflags="-oldcxx -D__osf__ -D__alpha"
   auxlibs="-lm"
   ;;
linuxrh42 | linuxrh51)
   # Linux with gcc 2.7.2.x
   auxcflags=
   auxlibs="-lg++ -lm -ldl -rdynamic"
   ;;
linux)
   # Linux with gcc >= 3.x
   auxcflags="-m32"
   auxldflags="-m32"
   auxlibs="-lm -ldl -rdynamic"
   ;;
linuxmips)
   # Linux on mips with gcc >= 3.x
   auxcflags="-mapi=32"
   auxldflags="-mapi=32"
   auxlibs="-lm -ldl -rdynamic"
   ;;
linuxhppa)
   # Linux on hppa with the GCC compiler
   auxcflags=
   auxldflags=
   auxlibs="-lm -ldl -rdynamic"
   ;;
linuxicc)
   # Linux with the Intel icc compiler
   auxcflags=
   auxlibs="-limf -lm -ldl"
   ;;
linuxppcgcc)
   # PPC Linux with gcc
   auxcflags="-fsigned-char -I/usr/X11/include"
   auxlibs="-lm -ldl -rdynamic"
   ;;
linuxppc64gcc)
   # PPC64 (64 bit mode) Linux with gcc 3.x
   auxcflags="-m64 -fsigned-char"
   auxldflags="-m64"
   auxlibs="-lm -ldl -rdynamic"
   ;;
linuxia64gcc)
   # Itanium Linux with gcc 2.x/3.x
   auxcflags=
   auxlibs="-lm -ldl -rdynamic"
   ;;
linuxia64ecc)
   # Itanium Linux with Intel ecc compiler
   auxcflags=
   auxlibs="-lm -ldl"
   ;;
linuxx8664gcc)
   # AMD Opteron and Intel EM64T (64 bit mode) Linux with gcc 3.x
   auxcflags="-m64"
   auxldflags="-m64"
   auxlibs="-lm -ldl -rdynamic"
   ;;
linuxx8664icc)
   # AMD Opteron and Intel EM64T (64 bit mode) Linux with Intel icc
   auxcflags=
   auxlibs="-limf -lm -ldl"
   ;;
linuxalphagcc)
   # Alpha Linux with gcc
   auxcflags=
   auxlibs="-lm -ldl -rdynamic"
   ;;
linuxarm)
   # ARM Linux with gcc
   auxcflags="-fsigned-char"
   auxlibs="-lm -ldl -rdynamic"
   ;;
mklinux)
   # MkLinux with libc5
   auxcflags="-fsigned-char -I/usr/X11/include -I/usr/include/g++"
   auxlibs="-lg++ -lm -ldl -rdynamic"
   ;;
freebsd)
   # FreeBSD with libc5
   auxcflags=
   auxlibs="-lm -lg++"
   ;;
freebsd4)
   # FreeBSD 4 with glibc
   auxcflags=
   auxlibs="-lm -lstdc++"
   ;;
freebsd5|freebsd7)
   # FreeBSD 5/7 with glibc
   auxcflags=
   auxlibs="-lm -lstdc++"
   ;;
kfreebsd)
   # kFreeBSD with gcc
   auxcflags="-m32"
   auxldflags="-m32"
   auxlibs="-lm -ldl -rdynamic"
   ;;
kfreebsdx8664gcc)
   # AMD Opteron and Intel EM64T (64 bit mode) kFreeBSD with gcc
   auxcflags="-m64"
   auxldflags="-m64"
   auxlibs="-lm -ldl -rdynamic"
   ;;
openbsd)
   # OpenBSD with libc
   auxcflags=
   auxlibs="-lm -lstdc++"
   ;;
macosx)
   # MacOS X with gcc (GNU cc v3.1) and possible fink (fink.sf.net)
   macosx_minor=`sw_vers | sed -n 's/ProductVersion://p' | cut -d . -f 2`
   # cannot find the one linked to libGraf if relocated after built
   if [ $macosx_minor -le 4 ]; then
      rootlibs="$rootlibs -lfreetype"
   fi
   if [ $macosx_minor -le 3 ]; then
      finkdir=`which fink 2>&1 | sed -ne "s/\/bin\/fink//p"`
      auxcflags=`[ -d ${finkdir}/include ] && echo -I${finkdir}/include`
      auxcflags="-Wno-long-double $auxcflags"
      auxlibs="-lm `[ -d ${finkdir}/lib ] && echo -L${finkdir}/lib` -ldl"
      forcelibs=$rootulibs
      forceglibs=$rootuglibs
      forceevelibs=$rootuevelibs
   else
      auxcflags="-m32"
      auxldflags="-m32"
      auxlibs="-lm -ldl"
   fi
   ;;
macosxicc)
   # MacOS X with Intel icc compiler
   macosx_minor=`sw_vers | sed -n 's/ProductVersion://p' | cut -d . -f 2`
   # cannot find the one linked to libGraf if relocated after built
   if [ $macosx_minor -le 4 ]; then
      rootlibs="$rootlibs -lfreetype"
   fi
   auxcflags=
   auxlibs="-lm -ldl"
   ;;
macosx64)
   # MacOS X with gcc (GNU cc v4.x) in 64 bit mode
   macosx_minor=`sw_vers | sed -n 's/ProductVersion://p' | cut -d . -f 2`
   # cannot find the one linked to libGraf if relocated after built
   if [ $macosx_minor -le 4 ]; then
      rootlibs="$rootlibs -lfreetype"
   fi
   auxcflags="-m64"
   auxldflags="-m64"
   auxlibs="-lm -ldl"
   ;;
ios*)
   auxcflags="-m32"
   auxldflags="-m32"
   auxlibs="-lm -ldl"
   ;;
hiux)
   # Hitachi HIUX
   auxcflags=
   auxlibs="-lm -ldld"
   ;;
win32)
   # Win32
   auxcflags="-MD"
   if test "xno" = "xyes"; then
      auxcflags="-MDd"
   fi
   VC_MAJOR=`unset VS_UNICODE_OUTPUT; cl.exe 2>&1 | awk '{ if (NR==1) print $(NF-2) }' | cut -d'.' -f1`
   if test "$VC_MAJOR" != "" && test $VC_MAJOR -gt 13; then
      auxcflags="$auxcflags -EHs -GR"
   else
      auxcflags="$auxcflags -GR -GX -G5"
   fi
   auxlibs=
   forcelibs=$rootulibs
   forceglibs=$rootuglibs
   forceevelibs=$rootuevelibs
   ;;
win32gcc)
   # Win32 with cygwin gcc
   auxcflags=
   auxlibs=
   forcelibs=$rootulibs
   forceglibs=$rootuglibs
   forceevelibs=$rootuevelibs
   ;;
*)
   echo "root-config: \"$arch\" invalid architecture"
   echo "Please report to rootdev@root.cern.ch"
   exit 1
   ;;
esac


### compiler dependent settings ###

case $arch in
freebsd* | openbsd* | linux*)
   for f in $features ; do
      if test "x$f" = "xthread" ; then
         auxcflags="-pthread $auxcflags"
         auxlibs="-pthread $auxlibs"
      fi
      if test "x$f" = "xrpath" ; then
         auxlibs="-Wl,-rpath,$libdir $auxlibs"
      fi
      if test "x$f" = "xcxx11" ; then
         auxcflags="-std=c++11 -Wno-deprecated-declarations $auxcflags"
      fi
   done
   ;;
macosx*)
   for f in $features ; do
      if test "x$f" = "xthread" ; then
         if [ $macosx_minor -ge 5 ]; then
            auxcflags="-pthread $auxcflags"
            auxlibs="-lpthread $auxlibs"
         else
            auxcflags="-D_REENTRANT $auxcflags"
            auxlibs="-lpthread $auxlibs"
         fi
      fi
      if test "x$f" = "xrpath" ; then
         if [ $macosx_minor -ge 5 ]; then
            auxlibs="-Wl,-rpath,$libdir $auxlibs"
         fi
      fi
      if test "x$f" = "xcxx11" ; then
         auxcflags="-std=c++11 $auxcflags"
      fi
   done
   ;;
hpuxacc | hpuxia64acc)
   for f in $features ; do
      if test "x$f" = "xthread" ; then
         auxcflags="-mt $auxcflags"
         auxlibs="-mt $auxlibs"
      fi
   done
   ;;
win32)
   ;;
*)
   for f in $features ; do
      if test "x$f" = "xthread" ; then
         auxcflags="-D_REENTRANT $auxcflags"
         auxlibs="-lpthread $auxlibs"
      fi
   done
   ;;
esac

# allocator must be last in auxlibs
for f in $features ; do
   if test "x$f" = "xalloc" ; then
      auxlibs="$auxlibs  "
   fi
done

### end of machine and compiler dependent settings ###

prefix=/usr
if test "$platform" = "win32" && test "$prefix" != ""; then
   prefix=`cygpath -u $prefix`
fi
exec_prefix=${prefix}
exec_prefix_set=no
new_set=no
libsout=no
glibsout=no
noauxlibs=no
noauxcflags=no
noldflags=no

usage="\
Usage: root-config [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version]\
 [--cflags] [--auxcflags] [--ldflags] [--new] [--nonew] [--libs]\
 [--glibs] [--evelibs] [--bindir] [--libdir] [--incdir] [--etcdir]\
 [--noauxcflags] [--noauxlibs] [--noldflags] [--has-<feature>] [--arch]\
 [--platform] [--dicttype] [--config] [--features] [--svn-revision]\
 [--python-version] [--cc] [--cxx] [--f77] [--ld ] [--help]"

if test $# -eq 0; then
   echo "${usage}" 1>&2
   exit 1
fi

out=""

while test $# -gt 0; do
  case "$1" in
  -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
  *)    optarg= ;;
  esac

  case $1 in
    --arch)
      ### Output the arcitecture (compiler/OS combination)
      out="$out $arch"
      ;;
    --platform)
      ### Output the platform (OS)
      out="$out $platform"
      ;;
    --has-*)
      ### Check for feature
      f=`echo $1 | sed 's/--has-//'`
      for c in $features ; do
         if test "x$c" = "x$f" ; then
            out="$out yes"
            break
         fi
         c=""
      done
      if test "x$c" = "x" ; then
         out="$out no"
      fi
      ;;
    --prefix=*)
      ### Set the prefix
      if test "$platform" = "win32"; then
         ### We need to expand the path to backslash seperated path
         optarg=`cygpath -u $optarg`
      fi
      prefix=$optarg
      bindir=${prefix}/bin
      libdir=${prefix}/lib
      incdir=${prefix}/include
      if test $exec_prefix_set = no ; then
         exec_prefix=$optarg
      fi
      ;;
    --prefix)
      ### Output the prefix
      out="$out $prefix"
      ;;
    --exec-prefix=*)
      ### Set the exec-prefix
      if test "$platform" = "win32"; then
      ### We need to expand the path to backslash seperated path
         optarg=`cygpath -u $optarg`
      fi
      exec_prefix=$optarg
      exec_prefix_set=yes
      bindir=${exec_prefix}/bin
      libdir=${exec_prefix}/lib
      ;;
    --exec-prefix)
      ### Output the exec-prefix
      out="$out $prefix"
      ;;
    --nonew)
      ### Don't use the libNew library
      new_set="no"
      ;;
    --new)
      ### Use the libNew library
      new_set="yes"
      ;;
    --noauxlibs)
      noauxlibs="yes"
      ;;
    --noauxcflags)
      noauxcflags="yes"
      ;;
    --noldflags)
      noldflags="yes"
      ;;
    --version)
      ### Output the version number.  If RVersion.h can not be found, give up.
      if test -r ${incdir}/RVersion.h; then
         out="$out `sed -n 's,.*ROOT_RELEASE *\"\(.*\)\".*,\1,p' < ${incdir}/RVersion.h`"
      else
         echo "cannot read ${incdir}/RVersion.h"
         exit 1
      fi
      ;;
    --svn-revision)
      ### Output the version number.  If RVersion.h can not be found, give up.
      if test -r ${incdir}/RVersion.h; then
         out="$out `sed -n 's,.*ROOT_SVN_REVISION *\([0-9]*\).*,\1,p' < ${incdir}/RVersion.h`"
      else
         echo "cannot read ${incdir}/RVersion.h"
         exit 1
      fi
      ;;
    --python-version)
      out="$out 2.7"
      ;;
    --cflags)
      ### Output the compiler flags
      if test ${incdir} != /usr/include; then
         ### In case we're on a Win32 system, we need to expand the
         ### path to a backslash seperated path
         if test "$platform" = "win32"; then
            includes=-I\'`cygpath -w ${incdir}`\'
         else
            includes=-I${incdir}
         fi
      fi
      if test "x$noauxcflags" = "xyes" ; then
         out="$out $includes"
      else
         out="$out ${auxcflags} $includes"
      fi
      ;;
   --auxcflags)
      ### Output auxiliary compiler flags
      out="$out $auxcflags"
      ;;
    --ldflags)
      ### Output linker flags
      out="$out $auxldflags"
      ;;
    --libs)
      ### Output regular ROOT libraries.  If the user said --glibs --libs,
      ### we've already output the libraries, so we skip this section
      if test "x$libsout" = "xyes" ; then
         shift
         continue
      fi
      ### Set the flag
      libsout="yes"
      ### See if we need the new library
      if test "x$new_set" = "xyes"; then
         libs="${newlib} ${rootlibs}"
      else
         libs=${rootlibs}
      fi
      ### If we're on a win32 system, we need to change the -l prefix
      ### into a .lib suffix, and expand the paths to a backslash
      ### separated path.
      if test "$platform" = "win32"; then
         nlibs=`echo $libs | sed "s@-l\([a-zA-Z0-9]*\)@${libdir}/lib\1.lib@g"`
         libs=
         for i in $nlibs; do
            libs="$libs '`cygpath -w $i`'"
         done
      else
         if test "x$noldflags" = "xno" ; then
            out="$out -L${libdir}"
         fi
      fi
      if test "x$noauxlibs" = "xyes" ; then
         out="$out $forcelibs $libs"
      else
         out="$out $forcelibs $libs ${auxlibs}"
      fi
      ;;
    --glibs)
      ### Output graphics and normal libraries.
      ### If the user said --evelibs --glibs,
      ### we've already output the libraries, so we skip this section
      if test "x$glibsout" = "xyes" ; then
         shift
         continue
      fi
      ### Set the flag
      glibsout="yes"
      ### If the user said --libs --glibs, we don't need to add the
      ### regular ROOT libraries.
      glibsonly="no"
      if test "x$libsout" = "xno" ; then
         ### Set the flag
         libsout="yes"
         if test "x$new_set" = "xyes" ; then
            glibs="${newlib} ${rootglibs} ${rootlibs}"
         else
            glibs="${rootglibs} ${rootlibs}"
         fi
      else
         glibs="${rootglibs}"
         glibsonly="yes"
      fi
      ### If we're on a win32 system, we need to change the -l prefix
      ### into a .lib suffix, and expand the paths to a backslash
      ### separated path.
      if test "$platform" = "win32"; then
         nlibs=`echo $glibs | sed "s@-l\([a-zA-Z0-9]*\)@${libdir}/lib\1.lib@g"`
         glibs=
         for i in $nlibs; do
            glibs="$glibs '`cygpath -w $i`'"
         done
      else
        if test "x$noldflags" = "xno" ; then
           out="$out -L${libdir}"
        fi
      fi
      if test "x$glibsonly" = "xyes" ; then
         out="$out $forceglibs $glibs"
      else
         if test "x$noauxlibs" = "xyes" ; then
            out="$out $forcelibs $forceglibs $glibs"
         else
            out="$out $forcelibs $forceglibs $glibs ${auxlibs}"
         fi
      fi
      ;;
    --evelibs)
      ### Output eve, graphics and normal libraries.
      ### we've already output the libraries, so we skip this section
      if test "x$evelibsout" = "xyes" ; then
         shift
         continue
      fi
      ### Set the flag
      evelibsout="yes"
      ### If the user said --libs --glibs --evelibs, we don't need to add the
      ### regular and glib ROOT libraries.
      evelibsonly="no"
      eveandglibsonly="no"
      if test "x$libsout" = "xno" ; then
         ### Set the flag
         libsout="yes"
         if test "x$new_set" = "xyes" ; then
            evelibs="${newlib} ${rootevelibs} ${rootglibs} ${rootlibs}"
         else
            evelibs="${rootevelibs} ${rootglibs} ${rootlibs}"
         fi
      elif test "x$glibsout" = "xno" ; then
         ### Set the flag
         glibsout="yes"
         evelibs="${rootevelibs} ${rootglibs}"
         eveandglibsonly="yes"
      else
         evelibs="${rootevelibs}"
         evelibsonly="yes"
      fi
      ### If we're on a win32 system, we need to change the -l prefix
      ### into a .lib suffix, and expand the paths to a backslash
      ### separated path.
      if test "$platform" = "win32"; then
         nlibs=`echo $evelibs | sed "s@-l\([a-zA-Z0-9]*\)@${libdir}/lib\1.lib@g"`
         evelibs=
         for i in $nlibs; do
            evelibs="$evelibs '`cygpath -w $i`'"
         done
      else
        if test "x$noldflags" = "xno" ; then
           out="$out -L${libdir}"
        fi
      fi
      if test "x$evelibsonly" = "xyes" ; then
         out="$out $forceevelibs $evelibs"
      elif test "x$eveandglibsonly" = "xyes" ; then
         out="$out $forceglibs $forceevelibs $evelibs"
      else
         if test "x$noauxlibs" = "xyes" ; then
            out="$out $forcelibs $forceglibs $forceevelibs $evelibs"
         else
            out="$out $forcelibs $forceglibs $forceevelibs $evelibs ${auxlibs}"
         fi
      fi
      ;;
    --auxlibs)
      ### output the auxiliary libraries
      out="$out $auxlibs"
      ;;
    --bindir)
      ### output the executable directory
      out="$out $bindir"
      ;;
    --libdir)
      ### output the library directory
      out="$out $libdir"
      ;;
    --incdir)
      ### output the header directory
      out="$out $incdir"
      ;;
    --etcdir)
      ### output the etc directory
      out="$out $etcdir"
      ;;
    --config)
      ### output the configure arguments
      out="$out $configargs"
      ;;
    --features)
      ### output all supported features
      out="$out$features"  # no space, features starts with space
      ;;
    --dicttype)
      ### output the dictionary type
      out="$out $dicttype"
      ;;
    --cc)
      ### output used C compiler
      out="$out $altcc"
      ;;
    --cxx)
      ### output used C++ compiler
      out="$out $altcxx"
      ;;
    --f77)
      ### output used Fortran compiler
      out="$out $altf77"
      ;;
    --ld)
      ### output used Linker
      out="$out $altld"
      ;;
    --help)
      ### Print a help message
      echo "Usage: `basename $0` [options]"
      echo ""
      echo "  --arch                Print the architecture (compiler/OS)"
      echo "  --platform            Print the platform (OS)"
      echo "  --prefix[=dir]        Print or set prefix"
      echo "  --exec-prefix[=dir]   Print or set execution prefix"
      echo "  --libs                Print regular ROOT libraries"
      echo "  --glibs               Print regular + GUI ROOT libraries"
      echo "  --evelibs             Print regular + GUI + Eve libraries"
      echo "  --cflags              Print compiler flags and header path"
      echo "  --ldflags             Print linker flags"
      echo "  --bindir              Print the executable directory"
      echo "  --libdir              Print the library directory"
      echo "  --incdir              Print the header directory"
      echo "  --etcdir              Print the configuration directory"
      echo "  --auxlibs             Print auxiliary libraries"
      echo "  --auxcflags           Print auxiliary compiler flags"
      echo "  --[no]new             Turn on[off] use of libNew.so"
      echo "  --noauxlibs           Do not print auxiliary/system libraries"
      echo "  --noauxcflags         Do not print auxiliary compiler flags"
      echo "  --noldflags           Do not print linker flags"
      echo "  --config              Print arguments used for ./configure"
      echo "  --features            Print list of all supported features"
      echo "  --has-<feature>       Test if <feature> is compiled in"
      echo "  --dicttype            Print dictionary generator being used"
      echo "  --version             Print the ROOT version"
      echo "  --svn-revision        Print the ROOT SVN revision number"
      echo "  --python-version      Print the Python version used by ROOT"
      echo "  --cc                  Print alternative C compiler specified when ROOT was built"
      echo "  --cxx                 Print alternative C++ compiler specified when ROOT was built"
      echo "  --f77                 Print alternative Fortran compiler specified when ROOT was built"
      echo "  --ld                  Print alternative Linker specified when ROOT was built"
      echo "  --help                Print this message"
      exit 0
      ;;
    *)
      ### Give an error
      echo "Unknown argument \"$1\"!" 1>&2
      echo "${usage}" 1>&2
      exit 1
      ;;
  esac
  shift
done

### Output the stuff
echo $out