File: configure.in

package info (click to toggle)
mlpost 0.8.1-8
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,808 kB
  • ctags: 2,934
  • sloc: ml: 17,440; makefile: 469
file content (431 lines) | stat: -rw-r--r-- 12,959 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
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
##########################################################################
#                                                                        #
#  Copyright (C) Johannes Kanig, Stephane Lescuyer                       #
#  Jean-Christophe Filliatre, Romain Bardou and Francois Bobot           #
#                                                                        #
#  This software is free software; you can redistribute it and/or        #
#  modify it under the terms of the GNU Library General Public           #
#  License version 2.1, with the special exception on linking            #
#  described in file LICENSE.                                            #
#                                                                        #
#  This software 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.                  #
#                                                                        #
##########################################################################

# the script generated by autoconf from this input will set the following
# variables:
#   OCAMLC        "ocamlc" if present in the path, or a failure
#                 or "ocamlc.opt" if present with same version number as ocamlc
#   OCAMLOPT      "ocamlopt" (or "ocamlopt.opt" if present), or "no"
#   OCAMLBEST     either "byte" if no native compiler was found,
#                 or "opt" otherwise
#   OCAMLDEP      "ocamldep"
#   OCAMLLEX      "ocamllex" (or "ocamllex.opt" if present)
#   OCAMLYACC     "ocamlyac"
#   OCAMLLIB      the path to the ocaml standard library
#   OCAMLVERSION  the ocaml version number
#   OCAMLWEB      "ocamlweb" (not mandatory)
#   OCAMLWIN32    "yes"/"no" depending on Sys.os_type = "Win32"
#   EXE           ".exe" if OCAMLWIN32=yes, "" otherwise

# The name of the package and its version
AC_INIT(mlpost,0.8.1,[],[],[])

# The compilation date
TODAY=`date`

# Check for Ocaml compilers

# we first look for ocamlc in the path; if not present, we fail
AC_PATH_PROG(OCAMLC,ocamlc,no)
if test "$OCAMLC" = no ; then
	AC_MSG_ERROR(Cannot find ocamlc.)
fi

# we extract Ocaml version number and library path
OCAMLVERSION=`$OCAMLC -v | sed -n -e 's|.*version *\(.*\)$|\1|p' `
echo "ocaml version is $OCAMLVERSION"
OCAMLLIB=`$OCAMLC -v | tail -1 | cut -f 4 -d " "`
if test "$OCAMLLIB" != ${OCAMLLIB#/usr} -a \
        -d /usr/local${OCAMLLIB#/usr}; then
   OCAMLLIBLOCAL=/usr/local${OCAMLLIB#/usr}
   echo "ocaml library path is $OCAMLLIB and $OCAMLLIBLOCAL"
else
        echo "ocaml library path is $OCAMLLIB"
fi

case $OCAMLVERSION in
  3.10.0*)
    AC_MSG_ERROR(ocamlbuild is too buggy in this version. Aborting.)
    ;;
esac

# then we look for ocamlopt; if not present, we issue a warning
# if the version is not the same, we also discard it
# we set OCAMLBEST to "opt" or "byte", whether ocamlopt is available or not
AC_PATH_PROG(OCAMLOPT,ocamlopt,no)
OCAMLBEST=byte
if test "$OCAMLOPT" = no ; then
	AC_MSG_WARN(Cannot find ocamlopt; bytecode compilation only.)
else
	AC_MSG_CHECKING(ocamlopt version)
	TMPVERSION=`$OCAMLOPT -v | sed -n -e 's|.*version *\(.*\)$|\1|p' `
	if test "$TMPVERSION" != "$OCAMLVERSION" ; then
	    AC_MSG_RESULT(differs from ocamlc; ocamlopt discarded.)
	    OCAMLOPT=no
	else
	    AC_MSG_RESULT(ok)
	    OCAMLBEST=opt
	fi
fi

# checking for ocamlc.opt
AC_PATH_PROG(OCAMLCDOTOPT,ocamlc.opt,no)
if test "$OCAMLCDOTOPT" != no ; then
	AC_MSG_CHECKING(ocamlc.opt version)
	TMPVERSION=`$OCAMLCDOTOPT -v | sed -n -e 's|.*version *\(.*\)$|\1|p' `
	if test "$TMPVERSION" != "$OCAMLVERSION" ; then
	    AC_MSG_RESULT(differs from ocamlc; ocamlc.opt discarded.)
	else
	    AC_MSG_RESULT(ok)
	    OCAMLC=$OCAMLCDOTOPT
	fi
fi

# checking for ocamlopt.opt
if test "$OCAMLOPT" != no ; then
    AC_PATH_PROG(OCAMLOPTDOTOPT,ocamlopt.opt,no)
    if test "$OCAMLOPTDOTOPT" != no ; then
	AC_MSG_CHECKING(ocamlc.opt version)
	TMPVER=`$OCAMLOPTDOTOPT -v | sed -n -e 's|.*version *\(.*\)$|\1|p' `
	if test "$TMPVER" != "$OCAMLVERSION" ; then
	    AC_MSG_RESULT(differs from ocamlc; ocamlopt.opt discarded.)
	else
	    AC_MSG_RESULT(ok)
	    OCAMLOPT=$OCAMLOPTDOTOPT
	fi
    fi
fi

# checking for camlp4o
AC_PATH_PROG(CAMLP4O,camlp4o,no)
if test "$CAMLP4O" != no ; then
  AC_MSG_CHECKING(camlp4o version)
  TMPVER=`$CAMLP4O -version`
  if test "$TMPVER" != "$OCAMLVERSION" ; then
    AC_MSG_ERROR(differs from ocamlc; Aborting.)
  else
    AC_MSG_RESULT(ok)
  fi
fi

# currently commented out because some other part of the code relies on
# camlp4o in bytecode
#AC_PATH_PROG(CAMLP4ODOTOPT, camlp4o.opt,no)
#if test "$CAMLP4ODOTOPT" != no ; then
#  AC_MSG_CHECKING(camlp4o.opt version)
#  TMPVER=`$CAMLP4ODOTOPT -version`
#  if test "$TMPVER" != "$OCAMLVERSION" ; then
#    AC_MSG_ERROR(differs from ocamlc; Aborting.)
#  else
#    AC_MSG_RESULT(ok)
#    CAMLP4O=$CAMLP4ODOTOPT
#  fi
#fi

#checking for ocamldoc
AC_PATH_PROG(OCAMLDOC,ocamldoc,no)


# ocamldep, ocamllex and ocamlyacc should also be present in the path
AC_PATH_PROG(OCAMLDEP,ocamldep,no)
if test "$OCAMLDEP" = no ; then
	AC_MSG_ERROR(Cannot find ocamldep.)
fi

AC_PATH_PROG(OCAMLLEX,ocamllex,no)
if test "$OCAMLLEX" = no ; then
    AC_MSG_ERROR(Cannot find ocamllex.)
else
    AC_PATH_PROG(OCAMLLEXDOTOPT,ocamllex.opt,no)
    if test "$OCAMLLEXDOTOPT" != no ; then
	OCAMLLEX=$OCAMLLEXDOTOPT
    fi
fi

AC_PATH_PROG(OCAMLYACC,ocamlyacc,no)
if test "$OCAMLYACC" = no ; then
	AC_MSG_ERROR(Cannot find ocamlyacc.)
fi

#First check that the versions for ocamlbuild are OK
AC_PATH_PROG(OCAMLBUILD, ocamlbuild, no)
if test "$OCAMLBUILD" = no; then
    AC_MSG_ERROR(Cannot find ocamlbuild.)
else
    AC_MSG_CHECKING(ocamlbuild version)
    TMPVER=`$OCAMLBUILD -version | sed -n -e 's|.*ocamlbuild *\(.*\)$|\1|p' `
    case $OCAMLVERSION in
      3.10.1|3.10.2*)
        if test "$TMPVER" != "0.1"; then
          AC_MSG_ERROR(ocamlbuild version differs from ocamlc. Aborting.)
        else
          AC_MSG_RESULT(ok)
        fi ;;
      *)
        if false && test "$TMPVER" != "$OCAMLVERSION" ; then
          AC_MSG_ERROR(ocamlbuild version differs from ocamlc. Aborting.)
        else
          AC_MSG_RESULT(ok)
        fi ;;
    esac
fi
# Then check that we are dealing with ocamlbuild at the right place
AC_MSG_CHECKING(ocamlbuild place)
OCAMLBUILDLIB=$(ocamlbuild -where)
if test "$OCAMLBUILDLIB" != "${OCAMLLIB}/ocamlbuild"; then
  echo "ocamlbuild present but your ocamlbuild is not compatible with your ocamlc:"
  echo "ocamlbuild : $OCAMLBUILDLIB, ocamlc : $OCAMLLIB"
  AC_MSG_ERROR(ocamlbuild not at the right place)
else
   AC_MSG_RESULT(ok)
fi

AC_PATH_PROG(OCAMLWEB,ocamlweb,true)

# platform
AC_MSG_CHECKING(platform)
if echo "let _ = Sys.os_type" | ocaml | grep -q Win32; then
    AC_MSG_RESULT(Win32)
    OCAMLWIN32=yes
    EXE=.exe
    LIBEXT=.lib
    OBJEXT=.obj
else
    AC_MSG_RESULT(not Win32)
    OCAMLWIN32=no
    EXE=
    LIBEXT=.a
    OBJEXT=.o
fi


## Where are the library we need
# we look for ocamlfind; if not present, we just don't use it to find
# libraries
AC_CHECK_PROG(USEOCAMLFIND,ocamlfind,yes,no)

if test "$USEOCAMLFIND" = yes; then
   OCAMLFINDLIB=$(ocamlfind printconf stdlib)
   OCAMLFIND=$(which ocamlfind)
   if test "$OCAMLFINDLIB" != "$OCAMLLIB"; then
   USEOCAMLFIND=no;
   echo "but your ocamlfind is not compatible with your ocamlc:"
   echo "ocamlfind : $OCAMLFINDLIB, ocamlc : $OCAMLLIB"
   fi
fi

if test "$LIBDIR" = ""; then
   if test "$USEOCAMLFIND" = yes; then
        LIBDIR=$(ocamlfind printconf destdir)/mlpost
   else
        LIBDIR=$OCAMLLIB/mlpost
   fi
fi
echo "Mlpost library will be installed in: $LIBDIR"

AC_ARG_ENABLE(cairo,
  [  --enable-cairo enable the cairo backend (requires cairo library, implies --enable-concrete)[default=yes]],,
  enable_cairo=yes)

CAIRO=no
if test "$enable_cairo" = yes; then
  # checking for mlcairo
  if test "$USEOCAMLFIND" = yes; then
     CAIROLIB=$(ocamlfind query cairo)
  fi

  if test -n "$CAIROLIB";then
     echo "ocamlfind found cairo in $CAIROLIB"
     CAIRO=yes
  else
      AC_CHECK_FILE($OCAMLLIB/cairo/cairo.cma,CAIRO=yes,CAIRO=no)
      if test "$CAIRO" = yes; then
         CAIROLIB=$OCAMLLIB/cairo/
      elif test -n "$OCAMLLIBLOCAL"; then
         AC_CHECK_FILE($OCAMLLIBLOCAL/cairo/cairo.cma,CAIRO=yes,CAIRO=no)
         if test "$CAIRO" = yes; then
         CAIROLIB=$OCAMLLIBLOCAL/cairo/
         fi
      fi
  fi
fi

AC_ARG_ENABLE(concrete,
  [  --enable-concrete enable concrete computations (requires bitstring library) [default=yes]],,
  enable_concrete=yes)

BITSTRING=no
if test "$enable_concrete" = yes; then
  if test "$USEOCAMLFIND" = yes; then
     BITSTRINGLIB=$(ocamlfind query bitstring)
  fi

  if test -n "$BITSTRINGLIB";then
     echo "ocamlfind found bitstring in $BITSTRINGLIB"
     BITSTRING=yes
  else
      AC_CHECK_FILE($OCAMLLIB/bitstring/bitstring.cma,BITSTRING=yes,BITSTRING=no)
      if test "$BITSTRING" = yes; then
         BITSTRINGLIB=$OCAMLLIB/bitstring/
      elif test -n "$OCAMLLIBLOCAL"; then
         AC_CHECK_FILE($OCAMLLIBLOCAL/bitstring/bitstring.cma,BITSTRING=yes,BITSTRING=no)
         if test "$BITSTRING" = yes; then
         BITSTRINGLIB=$OCAMLLIBLOCAL/bitstring/
         fi
      fi
  fi
fi

if test "$BITSTRING" = yes; then
  if test "$CAIRO" = yes; then
    TAGS="-tags cairo_yes,concrete_yes"
    INCLUDELIBS="-I $CAIROLIB -I $BITSTRINGLIB"
    METAREQUIRESPACKAGE="unix cairo bitstring"
  else
    CAIRO=no
    TAGS="-tag concrete_yes"
    INCLUDELIBS="-I $BITSTRINGLIB"
    METAREQUIRESPACKAGE="unix bitstring"
  fi
else
  CAIRO=no
  BITSTRING=no
  TAGS=""
  INCLUDELIBS=""
  METAREQUIRESPACKAGE="unix"
fi

#TEMPORAIRE
#CAIRO=no
#INCLUDELIBS=""


AC_ARG_ENABLE(lablgtk,
  [  --enable-lablgtk enable the cairo backend (requires cairo library, implies --enable-lablgtk)[default=yes]],,
  enable_lablgtk=yes)

LABLGTK2=no
if test "$enable_lablgtk" = yes; then
   # checking for lablgtk2
   if test "$USEOCAMLFIND" == yes; then
      LABLGTK2LIB=$(ocamlfind query lablgtk2)
   fi

   if test -n "$LABLGTK2LIB";then
      echo "ocamlfind found lablgtk2 in $LABLGTK2LIB"
   else
    AC_CHECK_FILE($OCAMLLIB/lablgtk2/lablgtk.cma,LABLGTK2=yes,LABLGTK2=no)
    if test "$LABLGTK2" = yes; then
       LABLGTK2LIB=$OCAMLLIB/lablgtk2/
    elif test -n "$OCAMLLIBLOCAL"; then
       AC_CHECK_FILE($OCAMLLIBLOCAL/lablgtk2/lablgtk2.cma,LABLGTK2=yes,LABLGTK2=no)
       if test "$LABLGTK2" = yes; then
       LABLGTK2LIB=$OCAMLLIBLOCAL/lablgtk2/
       fi
    fi
   fi
fi

##AC_CHECK_FILE($OCAMLLIB/lablgtk2/lablgtk.cma,LABLGTK2=yes,LABLGTK2=no)
## AC_CHECK_PROG(LABLGTK2,lablgtk2,yes,no) not always available (Win32)
if test -n "$LABLGTK2LIB" ; then
   LABLGTK2=yes
dnl    INCLUDEGTK2="-I $LABLGTK2LIB"
   INCLUDEGTK2="-I +lablgtk2"
else
   LABLGTK2=no
fi

# checking for cairo.lablgtk2
if test "$USEOCAMLFIND" == yes; then
   CAIROLABLGTK2LIB=$(ocamlfind query cairo.lablgtk2)
fi

if test -n "$CAIROLABLGTK2LIB";then
   echo "ocamlfind found cairo.lablgtk2 in $CAIROLABLGTK2LIB"
else
    AC_CHECK_FILE($OCAMLLIB/cairo/cairo_lablgtk.cma,
        CAIROLABLGTK2=yes,CAIROLABLGTK2=no)
    if test "$CAIROLABLGTK2" = yes; then
        CAIROLABLGTK2LIB=$OCAMLLIB/lablgtk2/
    elif test -n "$OCAMLLIBLOCAL"; then
       AC_CHECK_FILE($OCAMLLIBLOCAL/cairo/cairo_lablgtk.cma,
        CAIROLABLGTK2=yes,CAIROLABLGTK2=no)
       if test "$CAIROLABLGTK2" = yes; then
        CAIROLABLGTK2LIB=$OCAMLLIBLOCAL/cairo/
       fi
    fi
fi

if test -n "$LABLGTK2LIB" ; then
   CAIROLABLGTK2=yes
else
   CAIROLABLGTK2=no
fi

#Viewer for ps and pdf
AC_CHECK_PROGS(PSVIEWER,gv evince)
AC_CHECK_PROGS(PDFVIEWER,xpdf acroread evince)

# substitutions to perform
AC_SUBST(OCAMLC)
AC_SUBST(OCAMLOPT)
AC_SUBST(CAMLP4O)
AC_SUBST(OCAMLDOC)
AC_SUBST(OCAMLDEP)
AC_SUBST(OCAMLLEX)
AC_SUBST(OCAMLYACC)
AC_SUBST(OCAMLBEST)
AC_SUBST(OCAMLVERSION)
AC_SUBST(OCAMLWEB)
AC_SUBST(OCAMLFIND)
AC_SUBST(OCAMLBUILD)
AC_SUBST(USEOCAMLFIND)
AC_SUBST(LABLGTK2)
AC_SUBST(INCLUDEGTK2)
AC_SUBST(LABLGTK2LIB)
AC_SUBST(CAIROLABLGTK2)
AC_SUBST(CAIROLABLGTK2LIB)
AC_SUBST(TAGS)
AC_SUBST(CAIROLIB)
AC_SUBST(INCLUDELIBS)
AC_SUBST(BITSTRINGLIB)
AC_SUBST(OCAMLWIN32)
AC_SUBST(EXE)
AC_SUBST(LIBEXT)
AC_SUBST(OBJEXT)
AC_SUBST(LIBDIR)
AC_SUBST(PACKAGE_VERSION)
AC_SUBST(TODAY)
AC_SUBST(METAREQUIRESPACKAGE)

echo "---------------------------------------------------"
echo "  Mlpost library will be installed in: $LIBDIR"
echo -n "  native code compilation: "
if test "$OCAMLBEST" == "opt"; then echo "yes"; else echo "no"; fi
echo "  Support for concrete computations in mlpost: "$BITSTRING
echo "  Cairo support in mlpost: "$CAIRO
echo "  Contrib mlpost_lablgtk : "$LABLGTK2
echo "---------------------------------------------------"

# Finally create the Makefile from Makefile.in

AC_CONFIG_FILES(META version.ml Makefile myocamlbuild.ml)
AC_OUTPUT
chmod a-w Makefile
chmod a-w myocamlbuild.ml
chmod a-w META
chmod a-w version.ml