File: configure

package info (click to toggle)
prooftree 0.13-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid, stretch
  • size: 592 kB
  • ctags: 668
  • sloc: ml: 4,462; sh: 117; makefile: 111
file content (169 lines) | stat: -rwxr-xr-x 4,205 bytes parent folder | download
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
#!/bin/sh

##############################################################################
#
# Configuration script for prooftree
# 
# Hendrik Tews Copyright (C) 2011 - 2016
# 
# This file is part of "prooftree".
# 
# "prooftree" is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
# 
# "prooftree" is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License in file COPYING in this or one of the parent
# directories for more details.
# 
# You should have received a copy of the GNU General Public License
# along with "prooftree". If not, see <http://www.gnu.org/licenses/>.
# 
# $Id: configure,v 1.7 2016/01/23 12:57:13 tews Exp $
# 
##############################################################################

root=/usr/local
bindir=$root/bin
mandir=$root/share/man
native=
ocamldep=
ocamlc=
prooftree=
ocamldoc=
lablgtkdir=
force_byte="false"

usage (){
    echo "Usage:"
    echo "./configure [OPTION]..."
    echo
    echo "Recognized options are:"
    echo "  --prefix <path>	installation prefix [/usr/local]"
    echo "  --bindir <path>	user executables [PREFIX/bin]"
    echo "  --mandir <path>	man pages [PREFIX/share/man]"
}

while : ; do
  case "$1" in
    "") break;;
    -help|--help) usage; exit 2;;
    -prefix|--prefix) bindir=$2/bin
                      mandir=$2/share/man
		      shift;;
    -bindir|--bindir) bindir=$2
		      shift;;
    -mandir|--mandir) mandir=$2
		      shift;;
    -test-byte)       force_byte="true";;
     *) echo "Unknown option \"$1\"." 1>&2; usage; exit 2;;
  esac
  shift
done


# check for ocamlc
ocbv=$(ocamlc -version)
if [ $? -ne 0 ] ; then
    echo compiler ocamlc not found. 
    echo Please install ocaml and/or adjust \$PATH
    exit 1
else
    echo ocamlc version $ocbv found.
fi

# check for ocamlopt.opt
ocvo=$(ocamlopt.opt -version)
if [ $? -eq 0 ] ; then
    echo ocamlopt.opt version $ocvo found. Native compilation enabled.
    native=true
else
    echo ocamlopt.opt not found. Native compilation disabled.
    native=false
fi

if [ $force_byte = "true" ] ; then
    native=false
fi

if [ $native = "true" ] ; then
    ocamldep=ocamldep.opt
    ocamlc=ocamlopt.opt
    prooftree=prooftree.opt
    ocamldoc=ocamldoc.opt
else
    ocamldep=ocamldep
    ocamlc=ocamlc
    prooftree=prooftree.byte
    ocamldoc=ocamldoc
fi

# check ocamldep
ocdepv=$($ocamldep -version)
if [ $? -ne 0 ] ; then
    echo $ocamlc exists but $ocamldep not. 
    echo Please check your ocaml installation!
    exit 1
fi

# check ocamldoc
ocdocv=$($ocamldoc -version)
if [ $? -ne 0 ] ; then
    echo $ocamlc exists but $ocamldoc not. 
    echo Please check your ocaml installation!
    exit 1
fi

# check for lablgtk
check_lablgtk () {
    echo test $ocamlc -I $1
    if [ $native = "true" ] ; then
	$ocamlc -o /dev/null -I $1 lablgtk.cmxa gtkInit.cmx
    else
	$ocamlc -o /dev/null -I $1 lablgtk.cma gtkInit.cmo
    fi
}

if check_lablgtk "+lablgtk2" ; then
    lablgtkdir="+lablgtk2"
elif ocamlfind query lablgtk2 > /dev/null ; then
    lablgtkdir=$(ocamlfind query lablgtk2)
    if check_lablgtk $lablgtkdir ; then
	true
    else
	lablgtkdir=""
    fi
fi

if [ $lablgtkdir = "" ] ; then
    echo library LablGtk not found. Please install package liblablgtk2-ocaml-dev.
    exit 1
fi


# Summary of the configuration
echo
echo "  Configuration summary:"
echo "    binaries   will be copied to $bindir"
echo "    man pages  will be copied to $mandir"
if [ $native = "true" ] ; then
    echo "    native-code compilation enabled with $ocamlc"
else
    echo "    native-code compilation disabled with $ocamlc"
fi
echo "    LablGtk2 at $lablgtkdir"


# Make the Makefile
sed -e "s|@BINDIR@|$bindir|" \
    -e "s|@MANDIR@|$mandir|" \
    -e "s|@PROOFTREE@|$prooftree|" \
    -e "s|@OCAMLC@|$ocamlc|" \
    -e "s|@OCAMLDEP@|$ocamldep|" \
    -e "s|@OCAMLDOC@|$ocamldoc|" \
    -e "s|@LABLGTKDIR@|$lablgtkdir|" \
    Makefile.in > Makefile