File: configure.ac

package info (click to toggle)
source-highlight 3.1.8-1.2
  • links: PTS
  • area: main
  • in suites: buster
  • size: 10,220 kB
  • sloc: sh: 11,709; cpp: 10,226; ansic: 9,521; makefile: 1,902; lex: 1,200; yacc: 1,021; php: 213; perl: 211; awk: 98; erlang: 94; lisp: 90; java: 75; ruby: 69; python: 61; asm: 43; ada: 36; ml: 29; haskell: 27; xml: 23; cs: 11; sql: 8; tcl: 7; sed: 4
file content (372 lines) | stat: -rw-r--r-- 11,291 bytes parent folder | download | duplicates (2)
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
# Copyright (C) 1999-2009 Lorenzo Bettini <http://www.lorenzobettini.it>
#
# This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

dnl Process this file with autoconf to produce a configure script.
AC_INIT(GNU source-highlight,3.1.8)

# this is requested for the install-data-local of doxygen documentation
AC_PREREQ([2.62])

AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4])

dnl for automake
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE

#API version (often = GENERIC_MAJOR_VERSION.GENERIC_MINOR_VERSION)
#API_VERSION=1.0
#AC_SUBST(API_VERSION)

#shared library versioning
LIBRARY_VERSION=4:1:0
#               | | |
#        +------+ | +---+
#        |        |     |
#      current:revision:age
#        |        |     |
#        |        |     +- increment if interfaces have been added
#        |        |        set to zero if interfaces have been removed
#        |        |        or changed
#        |        +- increment if source code has changed
#        |           set to zero if current is incremented
#        +- increment if interfaces have been added, removed or changed


AC_SUBST(LIBRARY_VERSION)
AC_DEFINE_UNQUOTED(LIBRARY_VERSION, "$LIBRARY_VERSION")

AC_SUBST(source_highlightdatadir)
AC_SUBST(source_highlightdocdir)
AC_SUBST(source_highlightlibdocdir)
AC_SUBST(source_highlightlibexampledir)
AC_SUBST(bash_completiondir)

source_highlightdatadir=$datadir/source-highlight
source_highlightdocdir=$docdir
source_highlightlibdocdir=$docdir/api
source_highlightlibexampledir=$docdir/examples
bash_completiondir=$sysconfdir/bash_completion.d

dnl the namespace and header directory
LIBRARY_NAMESPACE=srchilite
AC_SUBST(LIBRARY_NAMESPACE)

dnl Checks for C compiler.
AC_PROG_CC

dnl Use of GnuLib
gl_EARLY

dnl add options for non GNU compilers
AC_NONGNU_FLAGS

dnl Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_SIZE_T
AC_CHECK_HEADERS([libintl.h])
AC_CHECK_HEADERS([stddef.h])

dnl If on SCO UNIX, add `-lintl' to output variable `LIBS'
AC_SCO_INTL

dnl for Cygwin32 environment
dnl AM_CYGWIN32 (obsolete)
dnl AC_CYGWIN
AC_EXEEXT

dnl Checks for C++ compiler.
AC_PROG_CXX
AC_LANG_CPLUSPLUS
AC_PROG_AWK

AC_PROG_INSTALL

AM_PROG_LIBTOOL

dnl test for --enable-warnings command line option
AC_ARG_ENABLE( warnings, [  --enable-warnings       enable compiler warnings], AC_COMPILE_WARNINGS )

dnl check for STL
AC_CXX_HAVE_STL

dnl check for sstream.h
AC_CXX_HAVE_SSTREAM

dnl check for ios_base
AC_CXX_HAVE_IOS_BASE

dnl check for Boost regular expression library
AX_BOOST_BASE([1.33.1])
AX_BOOST_REGEX
dnl AC_CHECK_HEADERS([boost/shared_ptr.hpp])
dnl it's no use searching for shared_ptr.hpp: it's already included in boost base

dnl test for ch-root feature
AC_SUBST(CHROOT_INPUT_DIR)

AC_ARG_ENABLE( input-chroot,   [  --enable-input-chroot=DIR     change the root input dir], if test $enableval = yes || test $enableval = no; then echo "configure: error: you must specify a path for --enable-input-chroot" 1>&2; exit 1; else CHROOT_INPUT_DIR=$enableval; fi, CHROOT_INPUT_DIR= )

AC_DEFINE_UNQUOTED(CHROOT_INPUT_DIR, "$CHROOT_INPUT_DIR")

dnl AC_ARG_ENABLE( bash-completion-dir,   
dnl [  --bash-completion-dir=DIR     specify directory for bash completion files
dnl                          @<:@default=/etc/bash_completion.d@:>@], if test $enableval = yes || test $enableval = no; then echo "configure: error: you must specify a path for --bash-completion-dir" 1>&2; exit 1; else BASH_COMPLETION_DIR=$enableval; fi, BASH_COMPLETION_DIR="/etc/bash_completion.d/" )

AC_ARG_WITH([bash-completion],
	AS_HELP_STRING([--with-bash-completion@<:@=DIR@:>@], [install bash_completion conf file (default is yes) - it is possible to specify bash_completion's config file directory (default is SYSCONFDIR/bash_completion.d)]),
	[
    if test "$withval" = "no"; then
	BASH_COMPLETION_DIR=""
    elif test "$withval" = "yes"; then
        BASH_COMPLETION_DIR=$sysconfdir/bash_completion.d
    else
	BASH_COMPLETION_DIR="$withval"
    fi
    ],
    [BASH_COMPLETION_DIR=$sysconfdir/bash_completion.d])


AC_SUBST(BASH_COMPLETION_DIR)

dnl for yacc or bison
AC_PROG_YACC

dnl for lex or flex
AM_PROG_LEX

dnl Checks for libraries.
dnl Replace 'main' with a function in -lfl:
dnl we don't need lexlibrary
dnl AC_CHECK_LIB(fl, main)

dnl check for Electric Fence library, but do not link it automatically
AC_HAVE_LIBRARY(libefence.a, [LIBS="$LIBS"])

dnl if (f)lex library is not present (yywrap won't be found) we provide
dnl a simple implementation (see yywrap.cc) which will be included in
dnl added objs and linked against the program (see src/Makefile.am)
dnl this works with flex generated files (I don't know about others)
AC_REPLACE_FUNCS(yywrap)

dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(unistd.h)

# For gnulib.
AC_LANG_PUSH([C])
gl_INIT
AC_LANG_POP([C])

dnl needed by readtags.c
AC_TYPE_OFF_T

dnl this is only for developers who change src/cmdline.ggo file
dnl GNU gengetopt can be found at http://www.gnu.org/software/gengetopt
AC_PATH_PROGS(GENGETOPT, gengetopt)
AM_CONDITIONAL(NO_GENGETOPT, test -z "$ac_cv_path_GENGETOPT" )

dnl this is only for developers who use double dispatch
dnl doublecpp can be found at http://www.lorenzobettini.it/software/doublecpp
AC_PATH_PROGS(DOUBLECPP, doublecpp)
AM_CONDITIONAL(NO_DOUBLECPP, test -z "$ac_cv_path_DOUBLECPP" )

dnl this is for testing purpose and development
AC_PATH_PROGS(VALGRIND, valgrind)

dnl this is only for developers who use change command line options
AC_PATH_PROGS(HELP2MAN, help2man)
AM_CONDITIONAL(NO_HELP2MAN, test -z "$ac_cv_path_HELP2MAN" )

dnl this is for generating references
AC_PATH_PROGS(CTAGS, ctags exuberant-ctags)
if test -n "$ac_cv_path_CTAGS"; then
AC_CTAGS_FLAGS
AM_CONDITIONAL(NO_CTAGS, test "$ac_cv_ctags_flags" = "no" )
else
AM_CONDITIONAL(NO_CTAGS, test -z "$ac_cv_path_CTAGS" )
fi

# Check for doxygen program.
AC_ARG_WITH([doxygen],
            [AS_HELP_STRING([--with-doxygen],
              [build doxygen documentation for the api of the library])],
            [AC_PROG_TRY_DOXYGEN],
            [with_doxygen=check])

AM_CONDITIONAL([HAVE_DOXYGEN],[test -n "$DOXYGEN"])

dnl *******************
dnl added by me
dnl *******************

AC_PATH_PROGS(BASH_SHELL, bash sh)

dnl set some flags if it's bison
AC_SUBST(YFLAGS)dnl
YFLAGS="$YFLAGS -d"
AC_MSG_CHECKING( checking if it's bison )

if test "$ac_cv_prog_YACC" = "bison -y"; then
YFLAGS="$YFLAGS -o y.tab.c -l"
AC_MSG_RESULT( $ac_cv_prog_YACC )
else
YFLAGS="$YFLAGS -l"
AC_MSG_RESULT( no: it's $YACC )
fi

dnl CXXFLAGS="-DSOURCE_HIGHLIGHT_DATA_DIR=\\\"$source_highlightdatadir\\\" $CXXFLAGS"

AC_PATH_PROGS(TAR, tar gtar)

AC_PATH_PROGS(TEXI2HTML, texi2html)

AH_TEMPLATE(CHROOT_INPUT_DIR)
AH_TEMPLATE(LIBRARY_VERSION)

dnl compute relative paths
dnl adl_COMPUTE_STANDARD_RELATIVE_PATHS
adl_COMPUTE_RELATIVE_PATHS([bindir:datadir:bin_to_data])
source_highlight_lang_dir="$bin_to_data/source-highlight"
adl_NORMALIZE_PATH([source_highlight_lang_dir], prefix)
source_highlight_absolute_lang_dir=$source_highlightdatadir
adl_NORMALIZE_PATH([source_highlight_absolute_lang_dir], prefix)

AC_DEFINE_UNQUOTED([RELATIVEDATADIR], ["$source_highlight_lang_dir"],
                   [Define to the source-highlight
                   data directory relative to installation path.])
AC_DEFINE_DIR([ABSOLUTEDATADIR], [datadir/source-highlight],
                   [Define to the source-highlight
                   data directory absolute to installation path.])

bash_completiondir="${BASH_COMPLETION_DIR}"
AM_CONDITIONAL(USE_BASH_COMPLETION, test "${BASH_COMPLETION_DIR}" != "")

AM_MAINTAINER_MODE

if test "x$ac_cv_cxx_have_sstream" != "xyes"; then
  dnl generate the replacement for sstream
  AC_CONFIG_LINKS([sstream:_sstream])
fi
 

AC_CONFIG_FILES(
[
Makefile
source-highlight.pc
src-highlite.directive
m4/Makefile
gl/Makefile
src/Makefile
src/java2html
src/cpp2html
src/src-hilite-lesspipe.sh
src/source-highlight-esc.sh
doc/Makefile
lib/Makefile
lib/srchilite/Makefile
lib/srchilite/srchilite.doxyfile
lib/tests/Makefile
lib/examples/Makefile
lib/compat/Makefile
tests/Makefile
tests/output_dir/Makefile
source-highlight.spec])

AC_CONFIG_FILES([tests/valgrind_tests.sh], [chmod +x tests/valgrind_tests.sh])
AC_CONFIG_FILES([tests/valgrind_suppressions.sh], [chmod +x tests/valgrind_suppressions.sh])
AC_CONFIG_FILES([tests/valgrind_test.sh], [chmod +x tests/valgrind_test.sh])
AC_CONFIG_FILES([lib/tests/valgrind_test.sh], [chmod +x lib/tests/valgrind_test.sh])
AC_CONFIG_FILES([doc/shjs_css_transform.sh], [chmod +x doc/shjs_css_transform.sh])
AC_CONFIG_FILES([doc/gen_style_example.sh], [chmod +x doc/gen_style_example.sh])


AC_OUTPUT

if test "$ax_cv_boost_regex" = "yes"; then
  if test -z "$BOOST_REGEX_LIB"; then
    AC_MSG_ERROR([

ERROR! Boost::regex library is installed, but you
must specify the suffix with --with-boost-regex at configure
for instance, --with-boost-regex=boost_regex-gcc-1_31])
  else
    echo ""
    echo "Good - your configure finished. Start make now"
    echo ""
  fi
else
  AC_MSG_ERROR([

ERROR! Boost::regex library not installed.
Please install it (download at http://www.boost.org/)])
fi

echo "
  These programs are NOT required, and
  are useful only for source-highlight developers
  Gengetopt.........: $GENGETOPT
  Doublecpp.........: $DOUBLECPP
  Valgrind..........: $VALGRIND
"

echo "
  ($PACKAGE_NAME) version $PACKAGE_VERSION
  Prefix.........: $prefix
  Using Boost....: $BOOST_REGEX_LIB
  C++ Compiler...: $CXX $CXXFLAGS $CPPFLAGS
  Linker.........: $LD $LDFLAGS $LIBS
  Doxygen........: ${DOXYGEN:-NONE or not enabled}
  Help2Man.......: ${HELP2MAN:-NONE}
  Ctags..........: ${CTAGS:-NONE}
"

if test -z "$ac_cv_path_HELP2MAN"; then
   AC_MSG_WARN([

help2man is not installed so the man page will not
be updated in case command line options are changed.
This is important for maintainers only, though.])
fi

if test -z "$ac_cv_path_CTAGS"; then
   AC_MSG_WARN([

ctags is not installed so you won't be able to
generate references (--gen-references).
You can find it here http://ctags.sourceforge.net
])
else
if test "$ac_cv_ctags_flags" = "no"; then
   AC_MSG_WARN([

The ctags you have on your system cannot be used by source-highlight
(make sure you have a ctags that support --excmd option, e.g.,
exuberant ctags, You can find it here http://ctags.sourceforge.net).
so you won't be able to generate references (--gen-references).
])
fi
fi

if test -z "$DOXYGEN"; then
  echo "-----------------------------------------"
  echo " No Doxygen program found - continuing"
  echo " without Doxygen documentation support."
  echo " (it must be enabled with --with-doxygen)"
  echo "-----------------------------------------"
fi


if test "${BASH_COMPLETION_DIR}" != ""; then
   echo "Good: you're using bash_completion! dir: $BASH_COMPLETION_DIR"
else
   echo "you're not using bash_completion (I'm not installing its config file)."
   BASH_COMPLETION_DIR=""
fi
echo ""