File: configure.ac

package info (click to toggle)
libqalculate 5.8.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 11,996 kB
  • sloc: cpp: 126,833; sh: 694; makefile: 145; xml: 40; sed: 16
file content (337 lines) | stat: -rw-r--r-- 11,813 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
dnl
dnl configure.in for libqalculate
dnl

dnl  ----------------------
dnl | initialize autotools |---------------------------------------------------
dnl  ----------------------

AC_INIT([libqalculate],[5.8.2])
AC_CONFIG_SRCDIR(libqalculate/Calculator.cc)
AM_INIT_AUTOMAKE
AC_CONFIG_HEADERS(config.h)
AM_MAINTAINER_MODE
AC_CONFIG_MACRO_DIR(m4)

AC_ARG_ENABLE(textport, 
              [  --disable-textport	  Disable compiling the text port], 
              enable_textport=$enableval, 
              enable_textport="yes")

AC_ARG_ENABLE(defs2doc, 
              [  --enable-defs2doc	  Enable compiling the definitions documentation generator], 
              enable_defs2doc=$enableval, 
              enable_defs2doc="no")

AC_ARG_ENABLE(tests, 
              [  --enable-tests	  Enable compiling test programs], 
              enable_tests=$enableval, 
              enable_tests="no")

AC_ARG_ENABLE(unittests, 
              [  --enable-unittests	  Enable compiling unittest runner], 
              enable_unittests=$enableval, 
              enable_unittests="yes")


dnl  -------------------------------
dnl | check for neccessary programs |------------------------------------------
dnl  -------------------------------

AC_PROG_CC
AC_PROG_CXX
AX_PROG_CXX_FOR_BUILD
AC_PROG_LN_S
AC_PROG_EGREP

IT_PROG_INTLTOOL
LT_INIT

dnl  ------------------------------------
dnl | check for compiler characteristics |-------------------------------------
dnl  ------------------------------------

dnl Use -Wall if we have gcc.
changequote(,)dnl
if test "x$GCC" = "xyes"; then
  case " $CFLAGS " in
    *[\ \	]-Wall[\ \	]*) ;;
    *) CFLAGS="$CFLAGS -Wall" ;;
  esac
fi
changequote([,])dnl

dnl check for threading model
dnl TODO
AC_DEFINE([HAVE_PTHREADS],1,
        [Define if pthreads are present.])

dnl libtool versioning for libqalculate

dnl increment if the interface has additions, changes, removals.
QALCULATE_CURRENT=26

dnl increment any time the source changes; set to 
dnl  0 if you increment CURRENT
QALCULATE_REVISION=9

dnl increment if any interfaces have been added; set to 0
dnl  if any interfaces have been removed. removal has 
dnl  precedence over adding, so set to 0 if both happened.
QALCULATE_AGE=3

AC_SUBST(QALCULATE_CURRENT)
AC_SUBST(QALCULATE_REVISION)
AC_SUBST(QALCULATE_AGE)

dnl  --------------------------------
dnl | check for neccessary libraries |-----------------------------------------
dnl  --------------------------------

AC_CHECK_LIB(pthread, pthread_create, [LIBS="$LIBS -lpthread"])

AC_CHECK_HEADER(gmp.h, [], [AC_MSG_ERROR([gmp.h can't be found, or is unusable.])])
AC_CHECK_LIB(gmp, __gmpz_init, [LIBS="-lgmp $LIBS"], [AC_MSG_ERROR([libgmp not found or uses a different ABI.])])

AC_CHECK_HEADERS(mpfr.h, [], [AC_MSG_ERROR([mpfr.h can't be found, or is unusable.])])
AC_CHECK_LIB(mpfr, mpfr_get_version, [LIBS="-lmpfr $LIBS"], [AC_MSG_ERROR([libmpfr not found or uses a different ABI.])])

AC_LANG([C++])

AC_CHECK_HEADERS([unordered_map])
AC_CHECK_FUNCS([pipe2])

AC_ARG_ENABLE([compiled_definitions], AS_HELP_STRING([--enable-compiled-definitions], [compile definitions]))
AS_IF([test "x$enable_compiled_definitions" = "xyes"], [
	AC_DEFINE([COMPILED_DEFINITIONS], [1], [Compile definitions])
])
AM_CONDITIONAL(COMPILED_DEFINITIONS, [test "x$enable_compiled_definitions" = "xyes"])

AC_ARG_ENABLE([insecure], AS_HELP_STRING([--disable-insecure], [disable insecure functions (command) and variables (uptime)]))
AS_IF([test "x$enable_insecure" = "xno"], [
	AC_DEFINE([DISABLE_INSECURE], [1], [Disable insecure functions and variables])
])
AM_CONDITIONAL(DISABLE_INSECURE, [test "x$enable_insecure" = "xno"])


AC_ARG_WITH([libcurl], AS_HELP_STRING([--without-libcurl], [disable support for built-in retrieval of exchange rates]), [], [with_libcurl=yes])
AS_IF([test "x$with_libcurl" = "xyes"], [
	PKG_CHECK_MODULES([LIBCURL], [libcurl])
	AC_DEFINE([HAVE_LIBCURL], [1], [Use libcurl])
	AC_SUBST(LIBCURL_CFLAGS)
	AC_SUBST(LIBCURL_LIBS)
])

AC_ARG_WITH([icu], AS_HELP_STRING([--without-icu], [disable support for case-insensitive unicode strings]), [], [with_icu=yes])
AS_IF([test "x$with_icu" = "xyes"], [
	PKG_CHECK_MODULES([ICU], [icu-uc])
	AC_DEFINE([HAVE_ICU], [1], [Use icu])
	AC_SUBST(ICU_CFLAGS)
	AC_SUBST(ICU_LIBS)
])

AC_ARG_WITH([gnuplot-call], AS_HELP_STRING([--without-gnuplot-call], [disable support for invocation of external commands, including gnuplot, using popen]), [], [with_gnuplot_call=yes])
AS_IF([test "x$with_gnuplot_call" = "xyes"], [
	AC_DEFINE([HAVE_GNUPLOT_CALL], [1], [Call to external gnuplot])
])
AS_IF([test "x$with_gnuplot_call" = "xbyo"], [
	AC_DEFINE([HAVE_BYO_GNUPLOT], [1], [Call to gnuplot using a provided function])
])

PKG_CHECK_MODULES(LIBXML, [libxml-2.0 >= 2.3.8])
AC_SUBST(LIBXML_CFLAGS)
AC_SUBST(LIBXML_LIBS)

AM_ICONV()

dnl  --------------------------------
dnl | check for doxygen             |-----------------------------------------
dnl  --------------------------------

AC_CHECK_PROGS([DOXYGEN], [doxygen])
if test -z "$DOXYGEN"; then
   AC_MSG_WARN([Doxygen not found - API documentation will not be generated])
fi
AM_CONDITIONAL([HAVE_DOXYGEN], [test -n "$DOXYGEN"])

dnl  --------------------------------
dnl | check for readline            |-----------------------------------------
dnl  --------------------------------

QALCULATE_TEXT=""
LN_QALCULATE=""
USE_READLINE="yes"
READLINE_LIBS=""
if test "x$enable_textport" = "xyes" ; then
  QALCULATE_TEXT="qalc$EXEEXT"
  LN_QALCULATE="qalc"

  AC_MSG_CHECKING([whether to use readline])
  AC_ARG_WITH(readline,
  [  --with-readline         use readline in text port [[default=yes, default tries -lncurses, -lcurses, -ltermcap, -ltinfo]] ],
    [case "${withval}" in
      yes) USE_READLINE="yes" ; AC_MSG_RESULT([yes]) ;;
      no) USE_READLINE="no" ; AC_MSG_RESULT([no]) ;;
      only) USE_READLINE="yes"
            EXTRA_LIBREADLINE_DEPS=" "
            AC_MSG_RESULT([yes (using only readline)]) ;;
      *) USE_READLINE="yes"
         EXTRA_LIBREADLINE_DEPS="${withval}"
         AC_MSG_RESULT([yes (using extra libraries ${withval})]) ;;
    esac],[AC_MSG_RESULT([${USE_READLINE}])])

  dnl Checks for libraries.
  dnl When checking readline, check using extra libraries first.
  dnl We want to protect against the link somehow succeeding, but only
  dnl failing at runtime, as seems to happen on some BSD systems.
  if test "$USE_READLINE" = yes ; then
   AC_CHECK_HEADERS(readline/readline.h readline/history.h)
   if test "x${ac_cv_header_readline_readline_h}" != "xyes" -o "x${ac_cv_header_readline_history_h}" != "xyes"; then
     AC_MSG_WARN([Could not find the headers for libreadline.])
   else
    if test "$EXTRA_LIBREADLINE_DEPS" = "" ; then
      unset ac_cv_lib_readline_readline
      AC_CHECK_LIB(readline, readline, HAVE_LIBREADLINE=true,
                   HAVE_LIBREADLINE=false, -lncurses)
      if test x${HAVE_LIBREADLINE} = xtrue ; then
        echo "  Using -lreadline -lncurses"
        EXTRA_LIBREADLINE_DEPS=-lncurses
        AC_DEFINE(HAVE_LIBREADLINE, [1], [Define if the text port uses readline])
      else
        unset ac_cv_lib_readline_readline
        AC_CHECK_LIB(readline, readline, HAVE_LIBREADLINE=true,
                     HAVE_LIBREADLINE=false, -lcurses)
        if test x${HAVE_LIBREADLINE} = xtrue ; then
          echo "  Using -lreadline -lcurses"
          EXTRA_LIBREADLINE_DEPS=-lcurses
          AC_DEFINE(HAVE_LIBREADLINE, [1], [Define if the text port uses readline])
        else
          unset ac_cv_lib_readline_readline
          AC_CHECK_LIB(readline, readline, HAVE_LIBREADLINE=true,
                       HAVE_LIBREADLINE=false, -ltinfo)
          if test x${HAVE_LIBREADLINE} = xtrue ; then
            echo "  Using -lreadline -ltinfo"
            EXTRA_LIBREADLINE_DEPS=-ltinfo
            AC_DEFINE(HAVE_LIBREADLINE, [1], [Define if the text port uses readline])
          else
            unset ac_cv_lib_readline_readline
            AC_CHECK_LIB(readline, readline, HAVE_LIBREADLINE=true,
                         HAVE_LIBREADLINE=false, -ltermcap)
            if test x${HAVE_LIBREADLINE} = xtrue ; then
              echo "  Using -lreadline -ltermcap"
              EXTRA_LIBREADLINE_DEPS=-ltermcap
              AC_DEFINE(HAVE_LIBREADLINE, [1], [Define if the text port uses readline])
            else
              unset ac_cv_lib_readline_readline
              AC_CHECK_LIB(readline, readline, HAVE_LIBREADLINE=true,
                           HAVE_LIBREADLINE=false)
              if test x${HAVE_LIBREADLINE} = xtrue ; then
                AC_DEFINE(HAVE_LIBREADLINE, [1], [Define if the text port uses readline])
              fi
            fi
          fi
        fi
      fi
    else
      unset ac_cv_lib_readline_readline
      AC_CHECK_LIB(readline, readline, HAVE_LIBREADLINE=true,
                   HAVE_LIBREADLINE=false, ${EXTRA_LIBREADLINE_DEPS})
      if test x${HAVE_LIBREADLINE} = xtrue ; then
        echo "  Using -lreadline ${EXTRA_LIBREADLINE_DEPS}"
        AC_DEFINE(HAVE_LIBREADLINE, [1], [Define if the text port uses readline])
      fi
    fi
    if test x${HAVE_LIBREADLINE} = xtrue; then
      READLINE_LIBS="-lreadline -lhistory ${EXTRA_LIBREADLINE_DEPS}"
    else
      AC_MSG_WARN([Could not find libreadline.])
    fi
   fi
  fi
fi

AC_SUBST(READLINE_LIBS)
AC_SUBST(QALCULATE_TEXT)

AC_SUBST(LN_QALCULATE)

QALCULATE_DEFS2DOC=""
if test "x$enable_defs2doc" = "xyes" ; then
	QALCULATE_DEFS2DOC="defs2doc$EXEEXT"
fi
AC_SUBST(QALCULATE_DEFS2DOC)

QALCULATE_TEST=""
if test "x$enable_tests" = "xyes" ; then
	QALCULATE_TEST="test$EXEEXT"
fi
AC_SUBST(QALCULATE_TEST)

QALCULATE_UNITTEST=""
if test "x$enable_unittests" = "xyes" ; then
	QALCULATE_UNITTEST="unittest$EXEEXT"
fi
AC_SUBST(QALCULATE_UNITTEST)

AC_SEARCH_LIBS([nanosleep],[rt posix4])

dnl  -------------------------------------
dnl | internationalization (i18n) support |------------------------------------
dnl  -------------------------------------

GETTEXT_PACKAGE=libqalculate
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",[The package name for gettext])

dnl Please keep this in alphabetical order
ALL_LINGUAS="ca de es fr ka nl ru sv zh_CN zh_TW"
AM_GNU_GETTEXT(external)
AM_GNU_GETTEXT_VERSION([0.19.8])

if test "$USE_NLS" = yes; then
	AC_DEFINE([ENABLE_NLS], [1], [Define to 1 if translation of program messages to the user's native language is requested.])
fi

dnl AM_GLIB_GNU_GETTEXT sets $DATADIRNAME
AC_MSG_CHECKING(locale directory)
if test "x$prefix" = "xNONE"; then
  PACKAGE_LOCALE_DIR=$ac_default_prefix/share/locale
else
  PACKAGE_LOCALE_DIR=$prefix/share/locale
fi

dnl lconv
AC_CHECK_MEMBERS([struct lconv.int_p_cs_precedes,] dnl
[struct lconv.int_n_cs_precedes],[],[],[AC_INCLUDES_DEFAULT
#include <locale.h>])

AC_DEFINE_UNQUOTED(PACKAGE_LOCALE_DIR, "$PACKAGE_LOCALE_DIR",
	[The directory in which qalculate's locale data will be stored])
	 AC_MSG_RESULT("$PACKAGE_LOCALE_DIR")

QALCULATE_PODEFS_RULE='%.po: $(top_srcdir)/po-defs/$@ $(top_srcdir)/po-defs/remove-untranslated.cc; $(top_builddir)/po-defs/fixpo $(top_srcdir)/po-defs/$@ $@'
AC_SUBST(QALCULATE_PODEFS_RULE)

INTLTOOL_QALCULATE_DEFINITIONS_RULE='%.xml:       %.xml.in      $(INTLTOOL_MERGE) $(wildcard $(top_builddir)/po-defs/fixed/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po-defs/fixed/.intltool-merge-cache $(top_builddir)/po-defs/fixed $< [$]@'
AC_SUBST(INTLTOOL_QALCULATE_DEFINITIONS_RULE)

dnl  --------
dnl | output |-----------------------------------------------------------------
dnl  --------

AC_CONFIG_FILES([
  Makefile
  src/Makefile
  libqalculate/Makefile
  data/Makefile
  po/Makefile.in
  po-defs/Makefile
  po-defs/fixed/Makefile
  docs/Makefile
  docs/reference/Makefile
  man/Makefile
  tests/Makefile
  libqalculate.pc
])
AC_OUTPUT