File: configure.ac

package info (click to toggle)
ocaml-lastfm 0.1.2-1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 364 kB
  • ctags: 59
  • sloc: ml: 619; makefile: 119; sh: 3
file content (195 lines) | stat: -rw-r--r-- 5,474 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

# check for one particular file of the sources 
AC_INIT(ocaml-lastfm, 0.1.2, savonet-users@lists.sourceforge.net)

VERSION=$PACKAGE_VERSION
AC_SUBST(VERSION)
AC_MSG_RESULT([configuring $PACKAGE_STRING])

OCAMLFIND_LDCONF=""
AC_ARG_ENABLE([ldconf], AC_HELP_STRING([--disable-ldconf],[don't modify the dynamic loader configuration file (default is enable)]),[ac_enable_ldconf=$enableval],[ac_enable_ldconf=$enableval],[ac_enable_ldconf=yes])
if test "$ac_enable_ldconf" = no ; then
	AC_MSG_RESULT([disabling modification of ld.conf])
	OCAMLFIND_LDCONF=dummy
fi

# Check for Ocaml compilers

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

# we look for the directory of ocamlc in $OCAMLC
OCAMLBIN=`dirname $OCAMLC`

# 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 -n 1 | cut -f 4 -d " "`
echo "ocaml library path is $OCAMLLIB"

# 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

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

AC_PATH_PROG(OCAMLDOC,ocamldoc,no)

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

CAMLLIBPATH=`$OCAMLC -where`

AC_PROG_CC()

AC_MSG_CHECKING(for ocaml-pcre)
   if ! $OCAMLFIND query pcre > /dev/null 2>&1 ; then
       AC_MSG_ERROR(Not found.)
   else
   INC="$INC `$OCAMLFIND query pcre`"
   requires="$requires pcre"
   AC_MSG_RESULT(ok)
fi

AC_MSG_CHECKING(for ocaml xml-light)
   if ! $OCAMLFIND query xml-light > /dev/null 2>&1 ; then
       AC_MSG_ERROR(Not found.)
   else
   INC="$INC `$OCAMLFIND query xml-light`"
   requires="$requires xml-light"
   AC_MSG_RESULT(ok)
fi

#
# xmlplaylist
#

AC_ARG_WITH([xmlplaylist-dir],AC_HELP_STRING([--with-xmlplaylist-dir=path],
        [use "path" as the location of ocaml-xmlplaylist (autodetected by default)]))
if test -z "$with_xmlplaylist_dir"; then
  AC_MSG_CHECKING(for ocaml-xmlplaylist)
     if ! $OCAMLFIND query xmlplaylist > /dev/null 2>&1 ; then
         AC_MSG_ERROR(Not found.)
     fi
     INC="$INC `$OCAMLFIND query xmlplaylist`"
     requires="$requires xmlplaylist"
     AC_MSG_RESULT(ok)
else
  echo $with_xmlplaylist_dir | grep ^/ > /dev/null 2>&1 \
  || with_xmlplaylist_dir=$PWD/$with_xmlplaylist_dir
  _INC="$_INC $with_xmlplaylist_dir"
  _requires="$_requires xmlplaylist"
fi

#
# ocamlnet
#

AC_MSG_CHECKING(for netstring from ocamlnet)
   if ! $OCAMLFIND query netstring > /dev/null 2>&1 ; then
       AC_MSG_ERROR(Not found.)
   else
   INC="$INC `$OCAMLFIND query netstring`"
   requires="$requires netstring"
   AC_MSG_RESULT(ok)
fi

AC_MSG_CHECKING(for netclient from ocamlnet)
   if ! $OCAMLFIND query netclient > /dev/null 2>&1 ; then
       AC_MSG_ERROR(Not found.)
   else
   INC="$INC `$OCAMLFIND query netclient`"
   requires="$requires netclient"
   AC_MSG_RESULT(ok)
fi

if test "$OCAMLOPT" = no ; then
    BEST=byte
else
    BEST="byte opt"
fi

# substitutions to perform
AC_SUBST(VERSION)
AC_SUBST(OCAMLC)
AC_SUBST(OCAMLOPT)
AC_SUBST(OCAMLDEP)
AC_SUBST(OCAMLBEST)
AC_SUBST(OCAMLVERSION)
AC_SUBST(OCAMLLIB)
AC_SUBST(OCAMLBIN)
AC_SUBST(OCAMLDOC)
AC_SUBST(OCAMLFIND)
AC_SUBST(OCAMLFIND_LDCONF)
AC_SUBST(OCAMLCP)
AC_SUBST(CAMLLIBPATH)
AC_SUBST(BEST)
ALL_INC="`ocamlfind query -r -separator " " $requires` $_INC"
INC="$INC $_INC"
AC_SUBST(INC)
AC_SUBST(ALL_INC)
all_requires="`ocamlfind query -r -separator " " -format "%p" $requires` $_requires"
requires="$requires $_requires"
AC_SUBST(requires)
AC_SUBST(all_requires)

# Finally create the Makefile and samples
AC_CONFIG_FILES([Makefile],[chmod a-w Makefile])
AC_CONFIG_FILES([src/META])
AC_CONFIG_FILES([src/Makefile])
AC_CONFIG_FILES([src/constants.ml])
AC_CONFIG_FILES([examples/Makefile.request])
AC_CONFIG_FILES([examples/Makefile.submit])
AC_CONFIG_FILES([examples/Makefile.download])
AC_OUTPUT