Codebase list flickcurl / upstream/1.25 configure.ac
upstream/1.25

Tree @upstream/1.25 (Download .tar.gz)

configure.ac @upstream/1.25raw · history · blame

  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
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
#                                               -*- Autoconf -*-
# Copyright (C) 2007-2011 David Beckett http://www.dajobe.org/

AC_PREREQ([2.68])
AC_INIT([Flickcurl], [1.25], [http://bugs.librdf.org/], [flickcurl])
AC_CONFIG_SRCDIR([src/flickcurl.h])
AC_CONFIG_HEADERS([src/config.h])
AC_CONFIG_AUX_DIR(build)
AC_CONFIG_MACRO_DIR(build)
AM_INIT_AUTOMAKE([1.11 check-news std-options -Wobsolete -Wportability -Wsyntax -Wunsupported -Wextra-portability])

AM_MAINTAINER_MODE

if test "$USE_MAINTAINER_MODE" = yes; then 
  CFLAGS=`echo $CFLAGS | sed -e "s/-O[A-Za-z0-9]*//"`
  CXXFLAGS=`echo $CXXFLAGS | sed -e "s/-O[A-Za-z0-9]*//"`
  CPPFLAGS=`echo $CPPFLAGS | sed -e "s/-O[A-Za-z0-9]*//"`
fi

dnl need to change quotes to allow square brackets
changequote(<<, >>)dnl
version="$PACKAGE_VERSION.0"
version_major=`echo $version | sed -e 's/^\([^\.]*\)\.\([^\.]*\)\.\(.*\)$/\1/'`
version_minor=`echo $version | sed -e 's/^\([^\.]*\)\.\([^\.]*\)\.\(.*\)$/\2/'`
version_release=`echo $version | sed -e 's/^\([^\.]*\)\.\([^\.]*\)\.\(.*\)$/\3/'`
changequote([, ])dnl

version_decimal=`expr $version_major \* 10000 + $version_minor \* 100 + $version_release`
AC_DEFINE_UNQUOTED(FLICKCURL_VERSION_DECIMAL, $version_decimal, [Release version as a decimal])

# for flickcurl-config.in
FLICKCURL_VERSION_DECIMAL=$version_decimal
AC_SUBST(FLICKCURL_VERSION_DECIMAL)


# Libtool versioning
#
# CURRENT
#      The most recent interface number that this library implements.
# 
# REVISION
#      The implementation number of the CURRENT interface.
# 
# AGE
#      The difference between the newest and oldest interfaces that this
#      library implements.  In other words, the library implements all the
#      interface numbers in the range from number `CURRENT - AGE' to
#      `CURRENT'.
#
# Rules:
#  1. Start with version information of `0:0:0' for each libtool library.
#
#  2. Update the version information only immediately before a public
#     release of your software.  More frequent updates are unnecessary,
#     and only guarantee that the current interface number gets larger
#     faster.
#
#  3. If the library source code has changed at all since the last
#     update, then increment REVISION (`C:R:A' becomes `C:r+1:A').
#
#  4. If any interfaces have been added, removed, or changed since the
#     last update, increment CURRENT, and set REVISION to 0.
#
#  5. If any interfaces have been added since the last public release,
#     then increment AGE.
#
#  6. If any interfaces have been removed since the last public release,
#     then set AGE to 0.
#
# syntax: CURRENT[:REVISION[:AGE]]
LIBFLICKCURL_LIBTOOL_VERSION=0:0:0
AC_SUBST(LIBFLICKCURL_LIBTOOL_VERSION)


AC_CANONICAL_HOST
AM_SANITY_CHECK

# Checks for programs.
AM_PROG_AR
AM_PROG_CC_C_O

dnl Initialize libtool
LT_INIT

# Checks for libraries.

libxml_min_version=2.6.8
raptor_min_version=2.0.0
libcurl_min_version=7.10.0

# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([errno.h getopt.h stdlib.h stdint.h time.h string.h unistd.h])
AC_HEADER_TIME

# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T
AC_STRUCT_TM
AC_C_BIGENDIAN

AC_CHECK_TYPE([u32])
AC_CHECK_SIZEOF(unsigned int, 4)
AC_CHECK_SIZEOF(unsigned long, 4)

# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_FUNC_STRFTIME
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([getopt getopt_long gettimeofday memset strdup usleep vsnprintf])
AC_SEARCH_LIBS(nanosleep, rt posix4, 
               AC_DEFINE(HAVE_NANOSLEEP, 1, [Define to 1 if you have the 'nanosleep' function.]),
               AC_MSG_WARN(nanosleep was not found))

AM_CONDITIONAL(GETOPT, test $ac_cv_func_getopt = no -a $ac_cv_func_getopt_long = no)

AC_MSG_CHECKING(whether need to declare optind)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#ifdef HAVE_GETOPT_H
#include <getopt.h>
#endif]], [[int x=optind;
]])],[AC_MSG_RESULT(no)],[AC_DEFINE(NEED_OPTIND_DECLARATION, 1, need 'extern int optind' declaration?)
            AC_MSG_RESULT(yes)])

if test $ac_cv_func_vsnprintf = yes; then
  AC_MSG_CHECKING(vsnprintf has C99 compatible return value)
  AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdarg.h>
int is_c99(char *s, ...) {
  char buffer[32];
  va_list args;
  int r;
  va_start(args, s);
  r = vsnprintf(buffer, 5, s, args);
  va_end(args);

  return (r == 7);
}

int main(int argc, char* argv) {
  return is_c99("1234567");
}]])],[AC_MSG_RESULT(no)],[AC_DEFINE(HAVE_C99_VSNPRINTF, 1, vsnprint has C99 compatible return value)
    AC_MSG_RESULT(yes)], [ ], [ ])
fi


AC_CHECK_PROGS(RECHO, echo)
RECHO_C=
RECHO_N=
case `$RECHO -n x` in
  -n*)
    case `$RECHO 'xy\c'` in
      *c*)
         ;;
      xy)
         RECHO_C='\c'
         ;;
    esac;;
  *)
    RECHO_N='-n'
    ;;
esac

AC_CHECK_PROGS(PKG_CONFIG, pkg-config)

PKG_CONFIG_REQUIRES=


dnl libxml - required
LIBXML_MIN_VERSION=$libxml_min_version
AC_SUBST(LIBXML_MIN_VERSION)

AC_ARG_WITH(xml2-config, [  --with-xml2-config=PATH   Location of libxml xml2-config []], xml2_config="$withval", xml2_config="")

if test "X$xml2_config" != "Xno" ; then
  if test "X$xml2_config" != "X" ; then
    AC_MSG_CHECKING(for $xml2_config)

    if test -f $xml2_config ; then
      XML_CONFIG=$xml2_config
      AC_MSG_RESULT(yes)
    else
      AC_MSG_RESULT(no - searching PATH)
    fi
  fi

  if test "X$XML_CONFIG" = "X" ; then
    AC_CHECK_PROGS(XML_CONFIG, xml2-config)
  fi
fi

libxml_source=no
if test "X$XML_CONFIG" != "X"; then
  oCPPFLAGS="$CPPFLAGS"
  oLIBS="$LIBS"

  CPPFLAGS="`$XML_CONFIG --cflags` $CPPFLAGS"
  LIBS="$LIBS `$XML_CONFIG --libs`"
  AC_CHECK_FUNC(xmlCreatePushParserCtxt, have_xmlCreatePushParserCtxt=yes, have_xmlCreatePushParserCtxt=no)

  AC_MSG_CHECKING(for libxml via xml2-config)
  if test $have_xmlCreatePushParserCtxt = yes; then
    libxml_source="xml2-config"
    LIBXML_VERSION=`$XML_CONFIG --version`
  fi
  CPPFLAGS="$oCPPFLAGS"
  LIBS="$oLIBS"
else
  AC_MSG_CHECKING(for libxml via pkg-config)
  XML_CONFIG="$PKG_CONFIG libxml-2.0"
  if $XML_CONFIG --exists; then
    LIBXML_VERSION=`$XML_CONFIG --modversion 2>/dev/null`
    libxml_source="pkg-config"
  fi
fi

if test "$libxml_source" != "no"; then
  AC_MSG_RESULT(yes - $LIBXML_VERSION via $libxml_source)
else
  AC_MSG_RESULT(no - not found)
  AC_MSG_ERROR(Please install version $libxml_min_version or newer)
fi

libxml_min_version_dec=`echo $libxml_min_version | $AWK -F. '{printf("%d\n", 10000*$1 + 100*$2 + $3)};'`
libxml_version_dec=`echo $LIBXML_VERSION | $AWK -F. '{printf("%d\n", 10000*$1 + 100*$2 + $3)};'`
if test $libxml_version_dec -lt $libxml_min_version_dec; then
  AC_MSG_ERROR(libxml $LIBXML_VERSION is too old - $libxml_min_version or newer required.)
fi

LIBS="$LIBS `$XML_CONFIG --libs`"
CFLAGS="`$XML_CONFIG --cflags` $CFLAGS"

if test $libxml_source = "pkg-config"; then
  if test "X$PKG_CONFIG_REQUIRES" != X; then
    PKG_CONFIG_REQUIRES="$PKG_CONFIG_REQUIRES,"
  fi
  PKG_CONFIG_REQUIRES="$PKG_CONFIG_REQUIRES libxml-2.0 >= $LIBXML_MIN_VERSION"
fi

dnl curl - required
LIBCURL_MIN_VERSION=$libcurl_min_version
AC_SUBST(LIBCURL_MIN_VERSION)

AC_ARG_WITH(curl-config, [  --with-curl-config=PATH   Location of libcurl curl-config []], curl_config="$withval", curl_config="")

if test "X$curl_config" != "Xno" ; then
  if test "X$curl_config" != "X" ; then
    AC_MSG_CHECKING(for $curl_config)

    if test -f $curl_config ; then
      CURL_CONFIG=$curl_config
      AC_MSG_RESULT(yes)
    else
      AC_MSG_RESULT(no - searching PATH)
    fi
  fi

  if test "X$CURL_CONFIG" = "X" ; then
    AC_CHECK_PROGS(CURL_CONFIG, curl-config)
  fi
fi

libcurl_source=no
if test "X$CURL_CONFIG" != "X"; then
  oCPPFLAGS="$CPPFLAGS"
  oLIBS="$LIBS"

  CPPFLAGS="`$CURL_CONFIG --cflags` $CPPFLAGS"
  LIBS="$LIBS `$CURL_CONFIG --libs`"
  AC_CHECK_HEADER(curl/curl.h)
  AC_CHECK_FUNC(curl_easy_init, have_curl_easy_init=yes, have_curl_easy_init=no)

  AC_MSG_CHECKING(for libcurl via curl-config)
  if test $have_curl_easy_init = yes; then
    libcurl_source="curl-config"
    LIBCURL_VERSION=`$CURL_CONFIG --version | sed -e 's/^libcurl *//'`
  fi
  CPPFLAGS="$oCPPFLAGS"
  LIBS="$oLIBS"
else
  AC_MSG_CHECKING(for libcurl via pkg-config)
  CURL_CONFIG="$PKG_CONFIG libcurl"
  if $CURL_CONFIG --exists; then
    LIBCURL_VERSION=`$CURL_CONFIG --modversion 2>/dev/null`
    libcurl_source="pkg-config"
  fi
fi

if test "$libcurl_source" != "no"; then
  AC_MSG_RESULT(yes - $LIBCURL_VERSION via $libcurl_source)
else
  AC_MSG_RESULT(no - not found)
  AC_MSG_ERROR(Please install version $libcurl_min_version or newer)
fi

libcurl_min_version_dec=`echo $libcurl_min_version | $AWK -F. '{printf("%d\n", 10000*$1 + 100*$2 + $3)};'`
libcurl_version_dec=`echo $LIBCURL_VERSION | $AWK -F. '{printf("%d\n", 10000*$1 + 100*$2 + $3)};'`
if test $libcurl_version_dec -lt $libcurl_min_version_dec; then
  AC_MSG_ERROR(libcurl $LIBCURL_VERSION is too old - $libcurl_min_version or newer required.)
fi

LIBS="$LIBS `$CURL_CONFIG --libs`"
CFLAGS="`$CURL_CONFIG --cflags` $CFLAGS"

if test $libcurl_source = "pkg-config"; then
  if test "X$PKG_CONFIG_REQUIRES" != X; then
    PKG_CONFIG_REQUIRES="$PKG_CONFIG_REQUIRES,"
  fi
  PKG_CONFIG_REQUIRES="$PKG_CONFIG_REQUIRES libcurl >= $LIBCURL_MIN_VERSION"
fi


dnl raptor - optional
AC_ARG_WITH(raptor, [  --with-raptor=yes|no|2    Use Raptor to serialize to triples (default=auto)], with_raptor="$withval", with_raptor="auto")

# resolve autodetecting raptor
if test "$with_raptor" = auto; then
  if $PKG_CONFIG raptor2 --exists; then
    with_raptor=yes
  else
    with_raptor=no
  fi
fi

# Check raptor version and use it if new enough
RAPTOR_VERSION=
if test "$with_raptor" = yes -o "$with_raptor" = 2; then
  RAPTOR_VERSION=`$PKG_CONFIG raptor2 --modversion 2>/dev/null`

  if $PKG_CONFIG raptor2 --atleast-version=$raptor_min_version; then
    with_raptor=yes
  else
    with_raptor=no
    AC_MSG_WARN(Installed Raptor $RAPTOR_VERSION is too old - need $raptor_min_version)
  fi
else
  with_raptor="no"
fi
RAPTOR_MIN_VERSION=$raptor_min_version
AC_SUBST(RAPTOR_MIN_VERSION)


AM_CONDITIONAL(RAPTOR, test $with_raptor != no)
AC_MSG_CHECKING(whether to use Raptor)
if test "$with_raptor" = yes; then
  AC_MSG_RESULT(yes - $RAPTOR_VERSION)
  RAPTOR_LIBS="`$PKG_CONFIG raptor2 --libs`"
  RAPTOR_CFLAGS="`$PKG_CONFIG raptor2 --cflags`"

  LIBS="$LIBS $RAPTOR_LIBS"
  CPPFLAGS="$CPPFLAGS $RAPTOR_CFLAGS"

  if test "X$PKG_CONFIG_REQUIRES" != X; then
    PKG_CONFIG_REQUIRES="$PKG_CONFIG_REQUIRES,"
  fi
  PKG_CONFIG_REQUIRES="$PKG_CONFIG_REQUIRES raptor2 >= $raptor_min_version"
  AC_SUBST(RAPTOR_LIBS)
  AC_SUBST(RAPTOR_CFLAGS)
  AC_DEFINE(HAVE_RAPTOR, 1, [have Raptor RDF syntax library])
else
  AC_MSG_RESULT(no)
fi

AC_ARG_ENABLE(offline, [  --enable-offline        Turn on offline use of captured XML web service responses (default disabled).  ], offline="yes", offline="no")	
AC_MSG_CHECKING(using offline mode)
AC_MSG_RESULT($offline);
if test $offline = yes; then
  AC_DEFINE(OFFLINE, 1, [Offline mode])
fi
AM_CONDITIONAL(OFFLINE, test $offline = yes)


AC_ARG_ENABLE(capture, [  --enable-capture        Turn on capturing web service responses (default disabled).  ], capture="yes", capture="no")	
AC_MSG_CHECKING(capturing web service responses)
AC_MSG_RESULT($capture);
if test $capture = yes; then
  AC_DEFINE(CAPTURE, 1, [Capture web service responses])
fi

if test $offline = yes -a $capture = yes; then
  AC_MSG_ERROR(Cannot use both offline mode and capturing web service responses)
fi


dnl compiler checks

AC_DEFUN([FLICKCURL_CC_TRY_FLAG], [
  AC_MSG_CHECKING([whether $CC supports $1])
  flickcurl_save_CFLAGS="$CFLAGS"
  CFLAGS="$CFLAGS $1"
  AC_COMPILE_IFELSE([AC_LANG_SOURCE([ ])], [flickcurl_cc_flag=yes], [flickcurl_cc_flag=no])
  CFLAGS="$flickcurl_save_CFLAGS"
  if test "X$flickcurl_cc_flag" = "Xyes"; then
    ifelse([$2], , :, [$2])
  else
    ifelse([$3], , :, [$3])
  fi
  AC_MSG_RESULT($flickcurl_cc_flag)
])

# Just too annoying:
#  -Wmissing-format-attribute
possible_warnings="-Wall -Wextra \
-Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \
-Wmissing-declarations -Wnested-externs -Wredundant-decls -Wswitch-enum \
-Wsign-compare -Werror-implicit-function-declaration -Wwrite-strings
-Wpacked -Wpointer-arith -Wcast-align -Winit-self \
-Wunsafe-loop-optimizations -Wdeclaration-after-statement \
-Wold-style-definition \
-Wno-missing-field-initializers -Wno-unused-parameter"

warning_cflags=
if test "$USE_MAINTAINER_MODE" = yes; then
  AC_MSG_CHECKING(for supported $CC warning flags)
  AC_MSG_RESULT($warning_cflags)
  for warning in $possible_warnings; do
    FLICKCURL_CC_TRY_FLAG([$warning], [warning_cflags="$warning_cflags $warning"])
  done
  AC_MSG_CHECKING($CC supports warning flags)
  AC_MSG_RESULT($warning_cflags)
fi


CPPFLAGS="-DFLICKCURL_INTERNAL=1 $CPPFLAGS"

STANDARD_CFLAGS=
MAINTAINER_CFLAGS="$warning_cflags"

STANDARD_CFLAGS="$STANDARD_CFLAGS $CFLAGS"
if test "$USE_MAINTAINER_MODE" = yes; then
  CPPFLAGS="-g -DFLICKCURL_DEBUG=1 $CPPFLAGS"
  CFLAGS="$MAINTAINER_CFLAGS $CFLAGS"
fi

AC_SUBST(STANDARD_CFLAGS)

AC_SUBST(PKG_CONFIG_REQUIRES)

AC_SUBST(ECHO)

dnl automake 1.11
AM_SILENT_RULES([no])

AC_CONFIG_FILES([Makefile
src/Makefile
utils/Makefile
examples/Makefile
docs/Makefile
docs/version.xml
flickcurl.spec
flickcurl.rdf
flickcurl.pc])

AC_CONFIG_FILES([flickcurl-config], [chmod +x flickcurl-config])

dnl Check for gtk-doc and docbook
GTK_DOC_CHECK([1.3])

AC_OUTPUT

AC_MSG_RESULT([
Flickcurl build summary:
  libxml  $LIBXML_VERSION via $libxml_source
  curl    $LIBCURL_VERSION via $libcurl_source
  raptor  $RAPTOR_VERSION
])