configure.ac
author J. Ali Harlow <ali@juiblex.co.uk>
Sat Aug 23 11:13:48 2014 +0100 (2014-08-23)
changeset 440 48204dea0b9f
parent 434 2c25dc58c6d2
child 442 c4bcba8023a9
permissions -rw-r--r--
Remove INTLLIBS from librazor_la_LIBADD.

This partially reverts 611c84a3f4b4538a65d186050608c17adbf17770.
It's not clear what motivated the initial inclusion of INTLLIBS
here since the net effect is only seen in librazor.la and not
in razor.pc and librazor.la is not normally packaged. Certainly
neither the static nor the dynamic versions of librazor currently
use libintl. At best this would cause the linker to search a
static libintl for undefined symbols without finding any; at worse
it causes a static build of plover using librazor.la to fail if
no static version of libintl is installed.
rhughes@241
     1
dnl Process this file with autoconf to produce a configure script.
rhughes@241
     2
rhughes@241
     3
AC_PREREQ(2.59c)
ali@437
     4
AC_INIT([razor], [0.5.7], [ali@juiblex.co.uk])
ali@380
     5
AM_INIT_AUTOMAKE([])
ali@380
     6
AM_CONFIG_HEADER([config.h])
rhughes@241
     7
AM_MAINTAINER_MODE
rhughes@241
     8
rhughes@241
     9
# libtool versioning - this applies to all libraries in this package
rhughes@241
    10
#
rhughes@241
    11
# See http://sources.redhat.com/autobook/autobook/autobook_91.html#SEC91 for details
rhughes@241
    12
#
ali@423
    13
LT_CURRENT=4
ali@403
    14
LT_REVISION=0
ali@424
    15
LT_AGE=0
rhughes@241
    16
AC_SUBST(LT_CURRENT)
rhughes@241
    17
AC_SUBST(LT_REVISION)
rhughes@241
    18
AC_SUBST(LT_AGE)
rhughes@241
    19
rhughes@241
    20
AC_ISC_POSIX
rhughes@241
    21
AC_PROG_CC
ali@323
    22
gl_EARLY
rhughes@241
    23
AM_PROG_CC_STDC
rhughes@241
    24
AC_HEADER_STDC
ali@330
    25
AC_HEADER_SYS_WAIT
ali@322
    26
AC_CHECK_HEADERS([sys/mman.h])
ali@323
    27
gl_INIT
ali@328
    28
AC_CHECK_FUNCS([symlink chroot])
ali@427
    29
LT_INIT([win32-dll])
ali@427
    30
# Libtool supports a --disable-shared option to tell it to avoid
ali@427
    31
# building shared versions of libraries. In addition to this,we want
ali@427
    32
# to support building static versions of our executables. Libtool
ali@427
    33
# can do this (under the right circumstances) so we overload this
ali@427
    34
# switch for this purpose.
ali@427
    35
#
ali@427
    36
# The libtool option that we use (-static-libtool-libs) means to use
ali@427
    37
# static linking with libraries that supply a .la file and which
ali@427
    38
# include a non-empty value for "old_library". If the library doesn't
ali@427
    39
# include a .la file (they are deleted by some distributions), then
ali@427
    40
# this option will have no effect and likewise if old_library is set
ali@427
    41
# to '' (eg., if the library was build with --disable-static) then
ali@427
    42
# again -static-libtool-libs will have no effect.
ali@427
    43
#
ali@427
    44
# If old_library is set to a non-empty value, then specifying
ali@427
    45
# -static-libtool-libs will cause the link to fail if the old library
ali@427
    46
# cannot be found (libtool will not fallback to a shared library
ali@427
    47
# in these circumstances). This can happen with Fedora, for example,
ali@427
    48
# if a main mingw32 library package is installed but not the
ali@427
    49
# coresponding static sub-package. The solution is to either
ali@427
    50
# install the relevant static sub-packages or don't use --disable-shared.
ali@427
    51
AS_IF([test "$enable_shared" = no],[
ali@427
    52
  LDFLAGS="$LDFLAGS -static-libtool-libs"
ali@427
    53
])
ali@427
    54
LT_OUTPUT
ali@427
    55
ac_compile="./libtool --mode=compile --tag=CC $ac_compile"
ali@427
    56
ac_link="./libtool --mode=link --tag=CC $ac_link"
rhughes@241
    57
AC_PROG_MAKE_SET
rhughes@241
    58
AC_PROG_LN_S
rhughes@241
    59
AC_SYS_LARGEFILE
rhughes@241
    60
AM_PROG_CC_C_O
rhughes@241
    61
ali@416
    62
AC_ARG_ENABLE([atomic],
ali@416
    63
	      [AS_HELP_STRING([--disable-atomic],
ali@416
    64
	      		      [disable atomic transactions])],
ali@416
    65
	      [],
ali@416
    66
	      [enable_atomic=yes])
ali@416
    67
if test "$enable_atomic" = "yes"; then
ali@416
    68
    AC_DEFINE([ENABLE_ATOMIC],[1],[Define if atomic transactions are wanted.])
ali@416
    69
fi
ali@416
    70
ali@328
    71
AC_MSG_CHECKING([for Microsoft Windows native API])
ali@328
    72
case $host_os in
ali@328
    73
    *mingw*)	AC_DEFINE([MSWIN_API], 1,
ali@328
    74
		  [Define to 1 to use Microsoft Windows native API.])
ali@340
    75
		EXTRA_LIBS='-lshell32 -lws2_32'
ali@328
    76
		mswin_api=yes;;
ali@328
    77
    *)		mswin_api=no;;
ali@328
    78
esac
ali@328
    79
AC_MSG_RESULT([$mswin_api])
ali@328
    80
AM_CONDITIONAL(MSWIN_API, test "$mswin_api" = "yes")
ali@335
    81
AC_SUBST(EXTRA_LIBS)
ali@328
    82
ali@416
    83
if test "$enable_atomic" = "yes" -a "$mswin_api" = "yes"; then
ali@403
    84
    AC_MSG_CHECKING([for Microsoft Windows Kernel Transaction Manager])
ali@403
    85
    save_LIBS="$LIBS"
ali@403
    86
    LIBS="-lktmw32 $LIBS"
ali@403
    87
    AC_LINK_IFELSE([AC_LANG_PROGRAM([dnl
ali@403
    88
#include <windows.h>
ali@403
    89
#include <ktmw32.h>
ali@403
    90
], [(void)CreateTransaction(NULL,0,0,0,0,0,NULL);])],
ali@403
    91
      [have_windows_ktm="yes"; EXTRA_LIBS="-lktmw32 $EXTRA_LIBS"],
ali@403
    92
      [have_windows_ktm="no"])
ali@403
    93
    LIBS="$save_LIBS"
ali@403
    94
    AC_MSG_RESULT([$have_windows_ktm])
ali@403
    95
else
ali@403
    96
    have_windows_ktm="no"
ali@403
    97
fi
ali@403
    98
if test "$have_windows_ktm" = "yes"; then
ali@403
    99
    AC_DEFINE([HAVE_WINDOWS_KTM],[1],[Define if Windows KTM is available.])
ali@403
   100
fi
ali@403
   101
rhughes@241
   102
# Taken from dbus
rhughes@241
   103
AC_ARG_ENABLE(ansi,             [  --enable-ansi           enable -ansi -pedantic gcc flags],enable_ansi=$enableval,enable_ansi=no)
rhughes@241
   104
AC_ARG_ENABLE(verbose-mode,     [  --enable-verbose-mode   support verbose debug mode],enable_verbose_mode=$enableval,enable_verbose_mode=$USE_MAINTAINER_MODE)
rhughes@241
   105
rhughes@241
   106
if test "${enable_verbose_mode}" != no; then
rhughes@241
   107
    # To get -rdynamic you pass -export-dynamic to libtool.
rhughes@241
   108
    AC_DEFINE(BUILT_R_DYNAMIC,1,[whether -export-dynamic was passed to libtool])
rhughes@241
   109
    R_DYNAMIC_LDFLAG=-export-dynamic
rhughes@241
   110
else
rhughes@241
   111
    R_DYNAMIC_LDFLAG=
rhughes@241
   112
fi
rhughes@241
   113
AC_SUBST(R_DYNAMIC_LDFLAG)
rhughes@241
   114
rhughes@241
   115
#### gcc warning flags
rhughes@241
   116
rhughes@241
   117
if test "x$GCC" = "xyes"; then
rhughes@241
   118
  changequote(,)dnl
rhughes@241
   119
  case " $CFLAGS " in
rhughes@241
   120
  *[\ \	]-Wall[\ \	]*) ;;
rhughes@241
   121
  *) CFLAGS="$CFLAGS -Wall" ;;
rhughes@241
   122
  esac
rhughes@241
   123
rhughes@241
   124
  case " $CFLAGS " in
rhughes@241
   125
  *[\ \	]-Wchar-subscripts[\ \	]*) ;;
rhughes@241
   126
  *) CFLAGS="$CFLAGS -Wchar-subscripts" ;;
rhughes@241
   127
  esac
rhughes@241
   128
rhughes@241
   129
  case " $CFLAGS " in
rhughes@241
   130
  *[\ \	]-Wmissing-declarations[\ \	]*) ;;
rhughes@241
   131
  *) CFLAGS="$CFLAGS -Wmissing-declarations" ;;
rhughes@241
   132
  esac
rhughes@241
   133
rhughes@241
   134
  case " $CFLAGS " in
rhughes@241
   135
  *[\ \	]-Wnested-externs[\ \	]*) ;;
rhughes@241
   136
  *) CFLAGS="$CFLAGS -Wnested-externs" ;;
rhughes@241
   137
  esac
rhughes@241
   138
rhughes@241
   139
  case " $CFLAGS " in
rhughes@241
   140
  *[\ \	]-Wcast-align[\ \	]*) ;;
rhughes@241
   141
  *) CFLAGS="$CFLAGS -Wcast-align" ;;
rhughes@241
   142
  esac
rhughes@241
   143
rhughes@241
   144
  case " $CFLAGS " in
rhughes@241
   145
  *[\ \	]-Wformat[\ \	]*) ;;
rhughes@241
   146
  *) CFLAGS="$CFLAGS -Wformat" ;;
rhughes@241
   147
  esac
rhughes@241
   148
rhughes@241
   149
  case " $CFLAGS " in
rhughes@241
   150
  *[\ \	]-Wformat-security[\ \	]*) ;;
rhughes@241
   151
  *) CFLAGS="$CFLAGS -Wformat-security" ;;
rhughes@241
   152
  esac
rhughes@241
   153
rhughes@241
   154
  if test "x$enable_ansi" = "xyes"; then
rhughes@241
   155
    case " $CFLAGS " in
rhughes@241
   156
    *[\ \	]-ansi[\ \	]*) ;;
rhughes@241
   157
    *) CFLAGS="$CFLAGS -ansi" ;;
rhughes@241
   158
    esac
rhughes@241
   159
rhughes@241
   160
    case " $CFLAGS " in
rhughes@241
   161
    *[\ \	]-D_POSIX_C_SOURCE*) ;;
rhughes@241
   162
    *) CFLAGS="$CFLAGS -D_POSIX_C_SOURCE=199309L" ;;
rhughes@241
   163
    esac
rhughes@241
   164
rhughes@241
   165
    case " $CFLAGS " in
rhughes@241
   166
    *[\ \	]-D_BSD_SOURCE[\ \	]*) ;;
rhughes@241
   167
    *) CFLAGS="$CFLAGS -D_BSD_SOURCE" ;;
rhughes@241
   168
    esac
rhughes@241
   169
rhughes@241
   170
    case " $CFLAGS " in
rhughes@241
   171
    *[\ \	]-pedantic[\ \	]*) ;;
rhughes@241
   172
    *) CFLAGS="$CFLAGS -pedantic" ;;
rhughes@241
   173
    esac
rhughes@241
   174
  fi
rhughes@241
   175
  changequote([,])dnl
rhughes@241
   176
fi
rhughes@241
   177
krh@269
   178
krh@269
   179
# gcc default visibility stuff
krh@269
   180
krh@269
   181
have_gcc4=no
krh@269
   182
AC_MSG_CHECKING(for -fvisibility)
krh@269
   183
AC_COMPILE_IFELSE([
krh@269
   184
#if defined(__GNUC__) && (__GNUC__ >= 4)
krh@269
   185
#else
krh@269
   186
#error Need GCC 4.0 for visibility
krh@269
   187
#endif
krh@269
   188
int main () { return 0; } 
krh@269
   189
], have_gcc4=yes)
krh@269
   190
krh@269
   191
if test "x$have_gcc4" = "xyes"; then
krh@269
   192
   CFLAGS="$CFLAGS -fvisibility=hidden"
krh@269
   193
fi
krh@269
   194
AC_MSG_RESULT($have_gcc4)
krh@269
   195
ali@344
   196
REQUIREMENTS=""
ali@321
   197
AC_ARG_WITH([curl],
ali@321
   198
            [AS_HELP_STRING([--without-curl], [disable support for curl])],
ali@321
   199
            [],
ali@321
   200
            [with_curl=yes])
ali@321
   201
          
ali@321
   202
CURL_CFLAGS=
ali@321
   203
CURL_LIBS=
ali@321
   204
AS_IF([test "x$with_curl" != xno],
ali@321
   205
  [PKG_CHECK_MODULES(CURL, [libcurl])
ali@321
   206
   AC_DEFINE([HAVE_CURL], [1], [Define if you have curl])])
rhughes@241
   207
AC_SUBST(CURL_CFLAGS)
rhughes@241
   208
AC_SUBST(CURL_LIBS)
rhughes@241
   209
rhughes@241
   210
ZLIB_LIBS=""
rhughes@241
   211
AC_ARG_WITH(zlib, [  --with-zlib=<dir>       Use zlib from here],
rhughes@241
   212
                      [
rhughes@241
   213
                      zlib=$withval
rhughes@241
   214
                      CPPFLAGS="$CPPFLAGS -I$withval/include"
rhughes@241
   215
                      ]
rhughes@241
   216
                      )
rhughes@241
   217
AC_CHECK_HEADERS(zlib.h, [AC_DEFINE(HAVE_ZLIB_H)],
rhughes@241
   218
                 [AC_MSG_ERROR([Can't find zlib.h. Please install zlib.])])
ali@344
   219
save_ldflags="$LDFLAGS"
ali@344
   220
LDFLAGS="$LDFLAGS -L$zlib/lib"
ali@344
   221
AC_CHECK_LIB(z, inflate, [ZLIB_LIBS="-L$zlib/lib -lz"],
rhughes@241
   222
	     [AC_MSG_ERROR([Can't find zlib library. Please install zlib.])])
ali@344
   223
LDFLAGS="$save_ldflags"
rhughes@241
   224
AC_SUBST(ZLIB_LIBS)
rhughes@241
   225
rhughes@241
   226
EXPAT_LIB=""
rhughes@241
   227
AC_ARG_WITH(expat, [  --with-expat=<dir>      Use expat from here],
rhughes@241
   228
                      [
rhughes@241
   229
                      expat=$withval
rhughes@241
   230
                      CPPFLAGS="$CPPFLAGS -I$withval/include"
rhughes@241
   231
                      ]
rhughes@241
   232
                      )
rhughes@241
   233
AC_CHECK_HEADERS(expat.h, [AC_DEFINE(HAVE_EXPAT_H)], 
rhughes@241
   234
		 [AC_MSG_ERROR([Can't find expat.h. Please install expat.])])
ali@344
   235
save_ldflags="$LDFLAGS"
ali@344
   236
LDFLAGS="$LDFLAGS -L$expat/lib"
ali@344
   237
AC_CHECK_LIB(expat, XML_ParserCreate, [EXPAT_LIBS="-L$expat/lib -lexpat"],
rhughes@241
   238
	     [AC_MSG_ERROR([Can't find expat library. Please install expat.])])
ali@344
   239
LDFLAGS="$save_ldflags"
rhughes@241
   240
AC_SUBST(EXPAT_LIBS)
rhughes@241
   241
ali@320
   242
RPM_LIBS=""
ali@320
   243
AC_ARG_WITH(rpm, [  --with-rpm=<dir>      Use rpm from here])
ali@320
   244
ali@320
   245
AS_IF([test "$with_rpm" != no],
ali@320
   246
      [if test "$with_rpm" != yes; then
ali@320
   247
	    CPPFLAGS="$CPPFLAGS -I$with_rpm/include"
ali@320
   248
       fi
ali@320
   249
       AC_CHECK_HEADERS(rpm/rpmlib.h, [], 
ali@320
   250
		 [AC_MSG_ERROR([Can't find rpm/rpmlib.h. Please install rpm-devel or use --without-rpm.])])
ali@344
   251
       save_ldflags="$LDFLAGS"
ali@344
   252
       LDFLAGS="$LDFLAGS -L$with_rpm/lib"
ali@344
   253
       AC_CHECK_LIB(rpm,rpmdbOpen,[RPM_LIBS="-L$with_rpm/lib -lrpm"],
ali@320
   254
	     [AC_MSG_ERROR([Can't find rpm library. Please install rpm-devel or use --without-rpm.])])
ali@344
   255
       LDFLAGS="$save_ldflags"
ali@320
   256
       AC_DEFINE([HAVE_RPMLIB], [1], [Define if you have librpm])])
rhughes@241
   257
AC_SUBST(RPM_LIBS)
ali@320
   258
AM_CONDITIONAL([HAVE_RPMLIB], [test -n "$RPM_LIBS"])
ali@352
   259
ali@352
   260
AC_ARG_WITH([lua],
ali@352
   261
            [AS_HELP_STRING([--without-lua], [disable support for lua])],
ali@352
   262
            [],
ali@352
   263
            [with_lua=yes])
ali@428
   264
ali@352
   265
AS_IF([test "x$with_lua" != xno],
ali@352
   266
  [PKG_CHECK_MODULES(LUA, [lua])
ali@352
   267
   REQUIREMENTS="$REQUIREMENTS lua"
ali@352
   268
   AC_DEFINE([HAVE_LUA], [1], [Define if you have lua])
ali@352
   269
   AC_PATH_PROG(LUA, [lua], [no])
ali@352
   270
   AS_IF([test "x$LUA" = xno],
ali@352
   271
     [AC_MSG_ERROR([Can't find lua program. Please install lua-devel or use --without-lua.])])
ali@352
   272
   AC_DEFINE_UNQUOTED([LUA_BINARY], ["$LUA"],
ali@352
   273
     [Define to the location of the lua binary])])
ali@352
   274
AC_SUBST(LUA_CFLAGS)
ali@352
   275
AC_SUBST(LUA_LIBS)
ali@352
   276
AM_CONDITIONAL([HAVE_LUA], [test "x$with_lua" != xno])
ali@352
   277
ali@344
   278
AC_SUBST(REQUIREMENTS)
rhughes@241
   279
rhughes@241
   280
if test "x$GCC" = "xyes"; then
rhughes@241
   281
  LDFLAGS="-Wl,--as-needed $LDFLAGS"
rhughes@241
   282
fi
rhughes@241
   283
rhughes@241
   284
# *****************************
rhughes@241
   285
# Make available to Makefile.am
rhughes@241
   286
# *****************************
rhughes@241
   287
AC_SUBST(SYSCONFDIR, $sysconfdir)
rhughes@241
   288
rhughes@241
   289
# ********************
rhughes@241
   290
# Internationalisation
rhughes@241
   291
# ********************
rhughes@241
   292
ali@319
   293
IT_PROG_INTLTOOL([0.35.0])
rhughes@241
   294
GETTEXT_PACKAGE=razor
rhughes@241
   295
AC_SUBST([GETTEXT_PACKAGE])
rhughes@241
   296
AM_GLIB_GNU_GETTEXT
rhughes@241
   297
AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[gettext domain])
rhughes@241
   298
krh@262
   299
GTK_DOC_CHECK([1.9])
krh@262
   300
rhughes@241
   301
AC_OUTPUT([
rhughes@241
   302
Makefile
rhughes@241
   303
data/razor.pc
rhughes@241
   304
data/Makefile
rhughes@241
   305
librazor/Makefile
ali@364
   306
librazor/types/Makefile
rhughes@241
   307
src/Makefile
rhughes@241
   308
docs/Makefile
krh@262
   309
docs/version.xml
rhughes@241
   310
po/Makefile.in
ali@323
   311
gl/Makefile
ali@351
   312
test/Makefile
rhughes@241
   313
])
rhughes@241
   314
rhughes@241
   315
dnl ==========================================================================
rhughes@241
   316
echo "
rhughes@241
   317
                  razor $VERSION
rhughes@241
   318
                =================
rhughes@241
   319
rhughes@241
   320
        prefix:                     ${prefix}
rhughes@241
   321
        libdir:                     ${libdir}
rhughes@241
   322
        libexecdir:                 ${libexecdir}
rhughes@241
   323
        bindir:                     ${bindir}
rhughes@241
   324
        sbindir:                    ${sbindir}
rhughes@241
   325
        datadir:                    ${datadir}
rhughes@241
   326
        sysconfdir:                 ${sysconfdir}
rhughes@241
   327
        localstatedir:              ${localstatedir}
rhughes@241
   328
        docdir:                     ${docdir}
rhughes@241
   329
rhughes@241
   330
        compiler:                   ${CC}
rhughes@241
   331
        cflags:                     ${CFLAGS}
rhughes@241
   332
        Maintainer mode:            ${USE_MAINTAINER_MODE}
rhughes@241
   333
        Building verbose mode:      ${enable_verbose_mode}
krh@294
   334
        Building gtk-doc:           ${enable_gtk_doc}
rhughes@241
   335
"