All of SXEmacs' http URLs are now https. WooHoo!
[sxemacs] / modules / configure.ac
1 dnl SXEmacs emodules configure script
2 dnl -------------------------------------------------------------------------
3
4 AC_PREREQ(2.59)
5 AC_INIT([SXEmacs modules], [22.1.15],[https://issues.sxemacs.org/])
6 AC_CONFIG_HEADERS([config.emods.h])
7 AC_LANG(C)
8
9 dnl -------------------------------------------------------------------------
10 dnl Local copyright notices.
11 dnl -------------------------------------------------------------------------
12 AC_COPYRIGHT(
13 [#### Configuration script for SXEmacs modules.
14 #### Guess values for system-dependent variables and create Makefiles.
15 #### Copyright (C) 2006 Steve Youngs.
16 #### Copyright (C) 2006 Sebastian Freundt.
17
18 ### Don't edit this script!
19 ### This script was automatically generated by the `autoconf' program
20 ### from the file `./configure.ac'.
21 ### To rebuild it, execute the command
22 ###     autogen.sh (or autoreconf)
23 ### in the this directory.
24
25 ## This file is part of SXEmacs.
26
27 ## Redistribution and use in source and binary forms, with or without
28 ## modification, are permitted provided that the following conditions
29 ## are met:
30 ##
31 ## 1. Redistributions of source code must retain the above copyright
32 ##    notice, this list of conditions and the following disclaimer.
33 ##
34 ## 2. Redistributions in binary form must reproduce the above copyright
35 ##    notice, this list of conditions and the following disclaimer in the
36 ##    documentation and/or other materials provided with the distribution.
37 ##
38 ## 3. Neither the name of the author nor the names of any contributors
39 ##    may be used to endorse or promote products derived from this
40 ##    software without specific prior written permission.
41 ##
42 ## THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
43 ## IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
44 ## WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
45 ## DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
46 ## FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
47 ## CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
48 ## SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
49 ## BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
50 ## WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
51 ## OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
52 ## IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
53
54 ### For usage, run `./configure --help'
55 ###
56 ### If configure succeeds, it leaves its status in config.status.
57 ### A log of configuration tests can be found in config.log.
58 ### If configure fails after disturbing the status quo,
59 ###     config.status is removed.
60 ])
61
62
63 dnl -------------------------------------------------------------------------
64 dnl Command line argument processing.
65
66 dnl If you add or remove any options here, make sure you also update
67 dnl the section below it "Check for bogus options"
68
69 dnl Build Options
70 dnl =============
71 OG_OPTION_GROUP(Build Options)
72
73 OG_ARG_WITH([sxemacs],
74         AS_HELP_STRING([--with-sxemacs],
75                 [Specify the sxemacs binary to use.]),
76         [auto], [Auto], [og_any])
77
78 OG_ARG_WITH([sxemacs-from-the-future],
79         AS_HELP_STRING([--with-sxemacs-from-the-future],
80                 [Do NOT use me.]),
81         [no], [No], [og_any])
82
83 OG_ARG_WITH([sxemacs-headers],
84         AS_HELP_STRING([--with-sxemacs-headers],
85                 [Specify the directory of SXEmacs headers to use.]),
86         [auto], [Auto], [og_any])
87
88 OG_ARG_WITH([ellcc],
89         AS_HELP_STRING([--with-ellcc],
90                 [Specify the ellcc binary to use.]),
91         [auto], [Auto], [og_any])
92
93 OG_ARG_WITH([make-docfile],
94         AS_HELP_STRING([--with-make-docfile],
95                 [Specify the make-docfile binary to use.]),
96         [auto], [Auto], [og_any])
97
98
99 dnl Module Options
100 dnl ==============
101 OG_OPTION_GROUP(Module Options)
102
103 OG_MULTIARG_WITH([ell-modules],
104         AS_HELP_STRING([--with-ell-modules],
105                 [Which modules to compile and install.]),
106         [all], [all], [base64 ldap sample zlib])
107
108 OG_MULTIARG_WITH([static-modules],
109         AS_HELP_STRING([--with-static-modules],
110                 [Which modules to compile as archives for static linking.]),
111         [none], [none], [base64 ldap sample zlib])
112
113 dnl Installation Options
114 dnl ====================
115 OG_OPTION_GROUP(Installation Options)
116
117 dnl OG_ARG_WITH([module-dir],
118 dnl     AS_HELP_STRING([--with-module-dir],
119 dnl             [Specify the directory where the modules go.]),
120 dnl     [auto], [$prefix/lib/sxemacs/site-modules], [og_any])
121 OG_ARG_WITH([module-dir],
122         AS_HELP_STRING([--with-module-dir],
123                 [Specify the directory where the modules go.]),
124         [auto], [${libdir}/${instvardir}/modules], [og_any])
125
126 OG_ARG_WITH([package-dir],
127         AS_HELP_STRING([--with-package-dir],
128                 [Specify a package hierarchy where the elisp files go.]),
129         [auto], [$prefix/lib/sxemacs/site-packages], [og_any])
130
131
132 ## -------------------------------------------------------------------------
133 ## Check for users who regularly forget about running autoconf
134 ## -------------------------------------------------------------------------
135 if test -f $0.ac -a $0.ac -nt $0; then
136 ##      `dirname $0`/autogen.sh
137         AC_MSG_ERROR([What are you doing? RUN autoconf or autogen.sh NOW!!!])
138 fi
139
140 ## Now since the user ran us, we build a stand-alone module
141 AM_CONDITIONAL([AUTARKIC], [test "1" = "0"])
142
143 ### ------------------------------------------------------------------------
144 ### Detection routines
145 ### ------------------------------------------------------------------------
146
147 test "x$prefix" = xNONE && prefix=$ac_default_prefix
148 test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
149
150
151 AM_INIT_AUTOMAKE([foreign -Wall])
152 AC_PROG_RANLIB
153
154 ## Check for working SXEmacs
155 ## =========================
156
157 if test "$with_sxemacs_from_the_future" != "no"; then
158         EMACS=$with_sxemacs_from_the_future
159 elif test -n "$with_sxemacs" -a "$with_sxemacs" != "yes"; then
160         EMACS=$with_sxemacs
161 elif test -n "$EMACS"; then
162         EMACS=$EMACS
163 elif test -n "$EDITOR"; then
164         EMACS=$EDITOR
165 else
166         EMACS=sxemacs
167 fi
168
169 sxebatch="$EMACS -batch -vanilla"
170 sxeflavour=t
171 if test "$with_sxemacs_from_the_future" = "no"; then
172         AC_MSG_CHECKING([for a working Emacs])
173         $sxebatch &>/dev/null && have_sxebatch=yes || have_sxebatch=no
174         if test "$have_sxebatch" = "yes"; then
175                 AC_MSG_RESULT([yes])
176         else
177                 AC_MSG_RESULT([no])
178                 AC_MSG_ERROR([Your emacs is too old, buggy, or non-existent.
179 Specify a *working* emacs via the EMACS or EDITOR environment variable.
180 Please note: GNU Emacs is _not_ a working version of Emacs hereby.])
181         fi
182
183         AC_MSG_CHECKING([for the flavour of Emacs])
184         sxeflavour=`$sxebatch -eval "(message \"%s\" (featurep 'sxemacs))" \
185                 2>&1 | tail -n1`
186         if test "$sxeflavour" = "t"; then
187                 AC_MSG_RESULT([SXEmacs (fortunately)])
188         else
189                 AC_MSG_RESULT([XEmacs])
190                 AC_MSG_CHECKING([whether XEmacs is working])
191                 majver=`$sxebatch -eval '(message "%s" emacs-major-version)' \
192                         2>&1 | tail -n1`
193                 minver=`$sxebatch -eval '(message "%s" emacs-minor-version)' \
194                         2>&1 | tail -n1`
195                 subver=`$sxebatch -eval '(message "%s" emacs-beta-version)' \
196                         2>&1 | tail -n1`
197                 if test "$majver" -ge 21 -a "$minver" -ge "4"; then
198                         if test "$minver" -eq "4"; then
199                                 AC_MSG_RESULT([yes ($majver.$minver.$subver)])
200                         else
201                                 AC_MSG_RESULT([no ($majver.$minver.$subver)])
202                                 AC_MSG_ERROR(
203 [We currently do not support the beta dnl
204 branch of XEmacs.
205 Consider installing SXEmacs.])
206                         fi
207                 else
208                         AC_MSG_RESULT([no ($majver.$minver.$subver)])
209                         AC_MSG_ERROR([Your XEmacs is waaaay too old.])
210                 fi
211         fi
212 fi
213
214 AC_SUBST(EMACS)
215 AC_SUBST(sxebatch)
216
217
218 ## Check for the sxemacs headers
219 ## =============================
220
221 if test "$with_sxemacs_from_the_future" = "no"; then
222         sxemoddir=`$sxebatch -eval "(message module-directory)" 2>&1 | tail -n1`
223         sxearchdir=`dirname $sxemoddir`
224         if test -z "$with_sxemacs_headers"; then
225                 with_sxemacs_headers=$sxearchdir/include
226         fi
227 fi
228
229 COLON_TO_SPACE(with_sxemacs_headers)
230
231 AC_MSG_CHECKING([for SXEmacs include directory])
232 if test -n "$with_sxemacs_headers"; then
233         AC_MSG_RESULT([$with_sxemacs_headers])
234 else
235         AC_MSG_RESULT([no])
236         AC_MSG_ERROR(['$with_sxemacs_headers' does not exist])
237 fi
238
239 echo $with_sxemacs_headers
240 for i in $with_sxemacs_headers; do
241         echo $i
242         SXEMACS_INCLUDES="$SXEMACS_INCLUDES -I$i"
243 done
244 AC_SUBST(SXEMACS_INCLUDES)
245
246 ## Check for the sxemacs lisp or package path
247 ## ==========================================
248
249 if test "$with_sxemacs_from_the_future" = "no"; then
250         if test -z "$with_lisp_dir"; then
251                 sxelispdir=`$sxebatch -eval "(message lisp-directory)" \
252                         2>&1 | tail -n1`
253         fi
254 fi
255 if test -z "$with_package_dir"; then
256         AC_MSG_CHECKING([for package hierarchy])
257         pkgdir_candidates="\
258 $prefix/share/sxemacs/site-packages \
259 $prefix/share/xemacs/site-packages \
260 $prefix/lib/sxemacs/site-packages \
261 $prefix/lib/sxemacs/xemacs-packages \
262 $prefix/lib/xemacs/site-packages \
263 $prefix/lib/xemacs/xemacs-packages"
264         if test -n "$sxearchdir"; then
265                 pkgdir_candidates=$pkgdir_candidates" "`dirname $sxearchdir`
266         fi
267         for i in $pkgdir_candidates; do
268                 if test -e "$i" -a -z "$with_package_dir"; then
269                         AC_MSG_RESULT([$i])
270                         with_package_dir=$i
271                 fi
272         done
273
274         if test -z "$with_package_dir"; then
275                 AC_MSG_RESULT([no])
276         fi
277 fi
278
279 AC_MSG_CHECKING([whether package directory is indeed a directory])
280
281 if test -d "$with_package_dir"; then
282         AC_MSG_RESULT([yes])
283 else
284         AC_MSG_RESULT([no])
285         if test -n "$with_package_dir"; then
286                 AC_MSG_ERROR(['$with_package_dir' is not a directory])
287         fi
288 fi
289
290 packagedir=$with_package_dir
291 AC_SUBST([packagedir])
292
293 dnl this is necessary so automake loads lisp handling
294 dnl but automake's AM_PATH_LISPDIR is simply bullshit, we fake our own version
295 AC_DEFUN([AM_PATH_LISPDIR], [])
296 AM_PATH_LISPDIR
297
298 infodir=$packagedir/info
299 AC_SUBST([infodir])
300
301 etcdir=$packagedir/etc
302 AC_SUBST([etcdir])
303
304 ## Check for the sxemacs lisp or package path
305 ## ==========================================
306
307 if test -z "$with_module_dir"; then
308         AC_MSG_CHECKING([for module hierarchy])
309         moddir_candidates="\
310 $prefix/lib/sxemacs/site-modules \
311 $prefix/lib/xemacs/site-modules \
312 $sxemoddir"
313         for i in $moddir_candidates; do
314                 if test -e "$i" -a -z "$with_module_dir"; then
315                         AC_MSG_RESULT([$i])
316                         with_module_dir=$i
317                 fi
318         done
319
320         if test -z "$with_module_dir"; then
321                 AC_MSG_RESULT([no])
322         fi
323 fi
324
325 AC_MSG_CHECKING([whether module directory is indeed a directory])
326
327 if test -d "$with_module_dir"; then
328         AC_MSG_RESULT([yes])
329 elif test "$with_sxemacs_from_the_future" != "no"; then
330         AC_MSG_RESULT([probably yes ($with_module_dir)])
331 else
332         AC_MSG_RESULT([no])
333         AC_MSG_ERROR(['$with_module_dir' is not a directory])
334 fi
335
336 moduledir=$with_module_dir
337 AC_SUBST(moduledir)
338
339
340 ## Check for ellcc
341 ## ===============
342
343 AC_PROG_CC
344 AM_PROG_CC_C_O
345
346 if test -z "$with_ellcc"; then
347         with_ellcc=`which ellcc`
348 fi
349 AC_MSG_CHECKING([for ellcc])
350 if test -f "$with_ellcc"; then
351         AC_MSG_RESULT([$with_ellcc])
352 else
353         AC_MSG_RESULT([no])
354         AC_MSG_ERROR([ellcc is mandatory. Consider --with-ellcc])
355 fi
356
357 AC_SUBST(CC)
358 ELLCC=$with_ellcc
359 AC_SUBST(ELLCC)
360 ELLCCLD="$with_ellcc --mode=link"
361 AC_SUBST(ELLCCLD)
362 MKINIT="$with_ellcc --mode=init"
363 AC_SUBST(MKINIT)
364
365 CFLAGS="-g -O3"
366 AC_SUBST(CFLAGS)
367 AC_SUBST(CPPFLAGS)
368
369
370 ## Check for make-docfile
371 ## ======================
372
373 if test -z "$with_make_docfile"; then
374         with_make_docfile=$sxearchdir/make-docfile
375 fi
376 AC_MSG_CHECKING([for make-docfile])
377 if test -f "$with_make_docfile"; then
378         AC_MSG_RESULT([$with_make_docfile])
379 elif test "$with_sxemacs_from_the_future" != "no"; then
380         AC_MSG_RESULT([probably yes ($with_make_docfile)])
381 else
382         AC_MSG_RESULT([no])
383         AC_MSG_WARN([make-docfile is extremely useful, consider --with-make-docfile])
384 fi
385
386 ELLMAKEDOC=$with_make_docfile
387 AC_SUBST(ELLMAKEDOC)
388
389
390 ## Available modules
391 ## =================
392
393 modules="base64 sample zlib"
394 AM_CONDITIONAL([EMOD_BASE64], [test "$with_ell_modules_base64" = "yes"])
395 AM_CONDITIONAL([EMOD_SAMPLE], [test "$with_ell_modules_sample" = "yes"])
396 AM_CONDITIONAL([EMOD_ZLIB], [test "$with_ell_modules_zlib" = "yes"])
397 AM_CONDITIONAL([STATIC_BASE64], [test "$with_static_modules_base64" = "yes"])
398 AM_CONDITIONAL([STATIC_SAMPLE], [test "$with_static_modules_sample" = "yes"])
399 AM_CONDITIONAL([STATIC_ZLIB], [test "$with_static_modules_zlib" = "yes"])
400 AM_CONDITIONAL([DESCEND_BASE64],
401         [test "$with_static_modules_base64" = "yes" -o \
402                 "$with_ell_modules_base64" = "yes"])
403 AM_CONDITIONAL([DESCEND_SAMPLE],
404         [test "$with_static_modules_sample" = "yes" -o \
405                 "$with_ell_modules_sample" = "yes"])
406 AM_CONDITIONAL([DESCEND_ZLIB],
407         [test "$with_static_modules_zlib" = "yes" -o \
408                 "$with_ell_modules_zlib" = "yes"])
409 AM_CONDITIONAL([FROM_THE_FUTURE],
410         [test "$with_sxemacs_from_the_future" != "no"])
411
412 AC_CONFIG_FILES([
413         Makefile
414         base64/Makefile
415         sample/Makefile
416         zlib/Makefile
417 ])
418 dnl ldap/Makefile - totally b0rked
419
420 AC_OUTPUT