configure.ac
author J. Ali Harlow <ali@juiblex.co.uk>
Thu Feb 16 17:33:47 2012 +0000 (2012-02-16)
changeset 424 8cbc438cc298
parent 423 6112bcc5d1cf
child 427 08b9c2e3cb37
permissions -rw-r--r--
Allow multiple atomic transactions to be used with one root object.
This allows transactions that include barriers to be performed
while holding an exclusive system lock.
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@420
     4
AC_INIT([razor], [0.5.4], [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@354
    29
AC_LIBTOOL_WIN32_DLL
rhughes@241
    30
AM_PROG_LIBTOOL
rhughes@241
    31
AC_PROG_MAKE_SET
rhughes@241
    32
AC_PROG_LN_S
rhughes@241
    33
AC_SYS_LARGEFILE
rhughes@241
    34
AM_PROG_CC_C_O
rhughes@241
    35
ali@416
    36
AC_ARG_ENABLE([atomic],
ali@416
    37
	      [AS_HELP_STRING([--disable-atomic],
ali@416
    38
	      		      [disable atomic transactions])],
ali@416
    39
	      [],
ali@416
    40
	      [enable_atomic=yes])
ali@416
    41
if test "$enable_atomic" = "yes"; then
ali@416
    42
    AC_DEFINE([ENABLE_ATOMIC],[1],[Define if atomic transactions are wanted.])
ali@416
    43
fi
ali@416
    44
ali@328
    45
AC_MSG_CHECKING([for Microsoft Windows native API])
ali@328
    46
case $host_os in
ali@328
    47
    *mingw*)	AC_DEFINE([MSWIN_API], 1,
ali@328
    48
		  [Define to 1 to use Microsoft Windows native API.])
ali@340
    49
		EXTRA_LIBS='-lshell32 -lws2_32'
ali@328
    50
		mswin_api=yes;;
ali@328
    51
    *)		mswin_api=no;;
ali@328
    52
esac
ali@328
    53
AC_MSG_RESULT([$mswin_api])
ali@328
    54
AM_CONDITIONAL(MSWIN_API, test "$mswin_api" = "yes")
ali@335
    55
AC_SUBST(EXTRA_LIBS)
ali@328
    56
ali@416
    57
if test "$enable_atomic" = "yes" -a "$mswin_api" = "yes"; then
ali@403
    58
    AC_MSG_CHECKING([for Microsoft Windows Kernel Transaction Manager])
ali@403
    59
    save_LIBS="$LIBS"
ali@403
    60
    LIBS="-lktmw32 $LIBS"
ali@403
    61
    AC_LINK_IFELSE([AC_LANG_PROGRAM([dnl
ali@403
    62
#include <windows.h>
ali@403
    63
#include <ktmw32.h>
ali@403
    64
], [(void)CreateTransaction(NULL,0,0,0,0,0,NULL);])],
ali@403
    65
      [have_windows_ktm="yes"; EXTRA_LIBS="-lktmw32 $EXTRA_LIBS"],
ali@403
    66
      [have_windows_ktm="no"])
ali@403
    67
    LIBS="$save_LIBS"
ali@403
    68
    AC_MSG_RESULT([$have_windows_ktm])
ali@403
    69
else
ali@403
    70
    have_windows_ktm="no"
ali@403
    71
fi
ali@403
    72
if test "$have_windows_ktm" = "yes"; then
ali@403
    73
    AC_DEFINE([HAVE_WINDOWS_KTM],[1],[Define if Windows KTM is available.])
ali@403
    74
fi
ali@403
    75
rhughes@241
    76
# Taken from dbus
rhughes@241
    77
AC_ARG_ENABLE(ansi,             [  --enable-ansi           enable -ansi -pedantic gcc flags],enable_ansi=$enableval,enable_ansi=no)
rhughes@241
    78
AC_ARG_ENABLE(verbose-mode,     [  --enable-verbose-mode   support verbose debug mode],enable_verbose_mode=$enableval,enable_verbose_mode=$USE_MAINTAINER_MODE)
rhughes@241
    79
rhughes@241
    80
if test "${enable_verbose_mode}" != no; then
rhughes@241
    81
    # To get -rdynamic you pass -export-dynamic to libtool.
rhughes@241
    82
    AC_DEFINE(BUILT_R_DYNAMIC,1,[whether -export-dynamic was passed to libtool])
rhughes@241
    83
    R_DYNAMIC_LDFLAG=-export-dynamic
rhughes@241
    84
else
rhughes@241
    85
    R_DYNAMIC_LDFLAG=
rhughes@241
    86
fi
rhughes@241
    87
AC_SUBST(R_DYNAMIC_LDFLAG)
rhughes@241
    88
rhughes@241
    89
#### gcc warning flags
rhughes@241
    90
rhughes@241
    91
if test "x$GCC" = "xyes"; then
rhughes@241
    92
  changequote(,)dnl
rhughes@241
    93
  case " $CFLAGS " in
rhughes@241
    94
  *[\ \	]-Wall[\ \	]*) ;;
rhughes@241
    95
  *) CFLAGS="$CFLAGS -Wall" ;;
rhughes@241
    96
  esac
rhughes@241
    97
rhughes@241
    98
  case " $CFLAGS " in
rhughes@241
    99
  *[\ \	]-Wchar-subscripts[\ \	]*) ;;
rhughes@241
   100
  *) CFLAGS="$CFLAGS -Wchar-subscripts" ;;
rhughes@241
   101
  esac
rhughes@241
   102
rhughes@241
   103
  case " $CFLAGS " in
rhughes@241
   104
  *[\ \	]-Wmissing-declarations[\ \	]*) ;;
rhughes@241
   105
  *) CFLAGS="$CFLAGS -Wmissing-declarations" ;;
rhughes@241
   106
  esac
rhughes@241
   107
rhughes@241
   108
  case " $CFLAGS " in
rhughes@241
   109
  *[\ \	]-Wnested-externs[\ \	]*) ;;
rhughes@241
   110
  *) CFLAGS="$CFLAGS -Wnested-externs" ;;
rhughes@241
   111
  esac
rhughes@241
   112
rhughes@241
   113
  case " $CFLAGS " in
rhughes@241
   114
  *[\ \	]-Wcast-align[\ \	]*) ;;
rhughes@241
   115
  *) CFLAGS="$CFLAGS -Wcast-align" ;;
rhughes@241
   116
  esac
rhughes@241
   117
rhughes@241
   118
  case " $CFLAGS " in
rhughes@241
   119
  *[\ \	]-Wformat[\ \	]*) ;;
rhughes@241
   120
  *) CFLAGS="$CFLAGS -Wformat" ;;
rhughes@241
   121
  esac
rhughes@241
   122
rhughes@241
   123
  case " $CFLAGS " in
rhughes@241
   124
  *[\ \	]-Wformat-security[\ \	]*) ;;
rhughes@241
   125
  *) CFLAGS="$CFLAGS -Wformat-security" ;;
rhughes@241
   126
  esac
rhughes@241
   127
rhughes@241
   128
  if test "x$enable_ansi" = "xyes"; then
rhughes@241
   129
    case " $CFLAGS " in
rhughes@241
   130
    *[\ \	]-ansi[\ \	]*) ;;
rhughes@241
   131
    *) CFLAGS="$CFLAGS -ansi" ;;
rhughes@241
   132
    esac
rhughes@241
   133
rhughes@241
   134
    case " $CFLAGS " in
rhughes@241
   135
    *[\ \	]-D_POSIX_C_SOURCE*) ;;
rhughes@241
   136
    *) CFLAGS="$CFLAGS -D_POSIX_C_SOURCE=199309L" ;;
rhughes@241
   137
    esac
rhughes@241
   138
rhughes@241
   139
    case " $CFLAGS " in
rhughes@241
   140
    *[\ \	]-D_BSD_SOURCE[\ \	]*) ;;
rhughes@241
   141
    *) CFLAGS="$CFLAGS -D_BSD_SOURCE" ;;
rhughes@241
   142
    esac
rhughes@241
   143
rhughes@241
   144
    case " $CFLAGS " in
rhughes@241
   145
    *[\ \	]-pedantic[\ \	]*) ;;
rhughes@241
   146
    *) CFLAGS="$CFLAGS -pedantic" ;;
rhughes@241
   147
    esac
rhughes@241
   148
  fi
rhughes@241
   149
  changequote([,])dnl
rhughes@241
   150
fi
rhughes@241
   151
krh@269
   152
krh@269
   153
# gcc default visibility stuff
krh@269
   154
krh@269
   155
have_gcc4=no
krh@269
   156
AC_MSG_CHECKING(for -fvisibility)
krh@269
   157
AC_COMPILE_IFELSE([
krh@269
   158
#if defined(__GNUC__) && (__GNUC__ >= 4)
krh@269
   159
#else
krh@269
   160
#error Need GCC 4.0 for visibility
krh@269
   161
#endif
krh@269
   162
int main () { return 0; } 
krh@269
   163
], have_gcc4=yes)
krh@269
   164
krh@269
   165
if test "x$have_gcc4" = "xyes"; then
krh@269
   166
   CFLAGS="$CFLAGS -fvisibility=hidden"
krh@269
   167
fi
krh@269
   168
AC_MSG_RESULT($have_gcc4)
krh@269
   169
ali@344
   170
REQUIREMENTS=""
ali@321
   171
AC_ARG_WITH([curl],
ali@321
   172
            [AS_HELP_STRING([--without-curl], [disable support for curl])],
ali@321
   173
            [],
ali@321
   174
            [with_curl=yes])
ali@321
   175
          
ali@321
   176
CURL_CFLAGS=
ali@321
   177
CURL_LIBS=
ali@321
   178
AS_IF([test "x$with_curl" != xno],
ali@321
   179
  [PKG_CHECK_MODULES(CURL, [libcurl])
ali@321
   180
   AC_DEFINE([HAVE_CURL], [1], [Define if you have curl])])
rhughes@241
   181
AC_SUBST(CURL_CFLAGS)
rhughes@241
   182
AC_SUBST(CURL_LIBS)
rhughes@241
   183
rhughes@241
   184
ZLIB_LIBS=""
rhughes@241
   185
AC_ARG_WITH(zlib, [  --with-zlib=<dir>       Use zlib from here],
rhughes@241
   186
                      [
rhughes@241
   187
                      zlib=$withval
rhughes@241
   188
                      CPPFLAGS="$CPPFLAGS -I$withval/include"
rhughes@241
   189
                      ]
rhughes@241
   190
                      )
rhughes@241
   191
AC_CHECK_HEADERS(zlib.h, [AC_DEFINE(HAVE_ZLIB_H)],
rhughes@241
   192
                 [AC_MSG_ERROR([Can't find zlib.h. Please install zlib.])])
ali@344
   193
save_ldflags="$LDFLAGS"
ali@344
   194
LDFLAGS="$LDFLAGS -L$zlib/lib"
ali@344
   195
AC_CHECK_LIB(z, inflate, [ZLIB_LIBS="-L$zlib/lib -lz"],
rhughes@241
   196
	     [AC_MSG_ERROR([Can't find zlib library. Please install zlib.])])
ali@344
   197
LDFLAGS="$save_ldflags"
rhughes@241
   198
AC_SUBST(ZLIB_LIBS)
rhughes@241
   199
rhughes@241
   200
EXPAT_LIB=""
rhughes@241
   201
AC_ARG_WITH(expat, [  --with-expat=<dir>      Use expat from here],
rhughes@241
   202
                      [
rhughes@241
   203
                      expat=$withval
rhughes@241
   204
                      CPPFLAGS="$CPPFLAGS -I$withval/include"
rhughes@241
   205
                      ]
rhughes@241
   206
                      )
rhughes@241
   207
AC_CHECK_HEADERS(expat.h, [AC_DEFINE(HAVE_EXPAT_H)], 
rhughes@241
   208
		 [AC_MSG_ERROR([Can't find expat.h. Please install expat.])])
ali@344
   209
save_ldflags="$LDFLAGS"
ali@344
   210
LDFLAGS="$LDFLAGS -L$expat/lib"
ali@344
   211
AC_CHECK_LIB(expat, XML_ParserCreate, [EXPAT_LIBS="-L$expat/lib -lexpat"],
rhughes@241
   212
	     [AC_MSG_ERROR([Can't find expat library. Please install expat.])])
ali@344
   213
LDFLAGS="$save_ldflags"
rhughes@241
   214
AC_SUBST(EXPAT_LIBS)
rhughes@241
   215
ali@320
   216
RPM_LIBS=""
ali@320
   217
AC_ARG_WITH(rpm, [  --with-rpm=<dir>      Use rpm from here])
ali@320
   218
ali@320
   219
AS_IF([test "$with_rpm" != no],
ali@320
   220
      [if test "$with_rpm" != yes; then
ali@320
   221
	    CPPFLAGS="$CPPFLAGS -I$with_rpm/include"
ali@320
   222
       fi
ali@320
   223
       AC_CHECK_HEADERS(rpm/rpmlib.h, [], 
ali@320
   224
		 [AC_MSG_ERROR([Can't find rpm/rpmlib.h. Please install rpm-devel or use --without-rpm.])])
ali@344
   225
       save_ldflags="$LDFLAGS"
ali@344
   226
       LDFLAGS="$LDFLAGS -L$with_rpm/lib"
ali@344
   227
       AC_CHECK_LIB(rpm,rpmdbOpen,[RPM_LIBS="-L$with_rpm/lib -lrpm"],
ali@320
   228
	     [AC_MSG_ERROR([Can't find rpm library. Please install rpm-devel or use --without-rpm.])])
ali@344
   229
       LDFLAGS="$save_ldflags"
ali@320
   230
       AC_DEFINE([HAVE_RPMLIB], [1], [Define if you have librpm])])
rhughes@241
   231
AC_SUBST(RPM_LIBS)
ali@320
   232
AM_CONDITIONAL([HAVE_RPMLIB], [test -n "$RPM_LIBS"])
ali@352
   233
ali@352
   234
AC_ARG_WITH([lua],
ali@352
   235
            [AS_HELP_STRING([--without-lua], [disable support for lua])],
ali@352
   236
            [],
ali@352
   237
            [with_lua=yes])
ali@352
   238
          
ali@352
   239
LUA_CFLAGS=
ali@352
   240
LUA_LIBS=
ali@352
   241
AS_IF([test "x$with_lua" != xno],
ali@352
   242
  [PKG_CHECK_MODULES(LUA, [lua])
ali@352
   243
   REQUIREMENTS="$REQUIREMENTS lua"
ali@352
   244
   AC_DEFINE([HAVE_LUA], [1], [Define if you have lua])
ali@352
   245
   AC_PATH_PROG(LUA, [lua], [no])
ali@352
   246
   AS_IF([test "x$LUA" = xno],
ali@352
   247
     [AC_MSG_ERROR([Can't find lua program. Please install lua-devel or use --without-lua.])])
ali@352
   248
   AC_DEFINE_UNQUOTED([LUA_BINARY], ["$LUA"],
ali@352
   249
     [Define to the location of the lua binary])])
ali@352
   250
AC_SUBST(LUA_CFLAGS)
ali@352
   251
AC_SUBST(LUA_LIBS)
ali@352
   252
AM_CONDITIONAL([HAVE_LUA], [test "x$with_lua" != xno])
ali@352
   253
ali@344
   254
AC_SUBST(REQUIREMENTS)
rhughes@241
   255
rhughes@241
   256
if test "x$GCC" = "xyes"; then
rhughes@241
   257
  LDFLAGS="-Wl,--as-needed $LDFLAGS"
rhughes@241
   258
fi
rhughes@241
   259
rhughes@241
   260
# *****************************
rhughes@241
   261
# Make available to Makefile.am
rhughes@241
   262
# *****************************
rhughes@241
   263
AC_SUBST(SYSCONFDIR, $sysconfdir)
rhughes@241
   264
rhughes@241
   265
# ********************
rhughes@241
   266
# Internationalisation
rhughes@241
   267
# ********************
rhughes@241
   268
ali@319
   269
IT_PROG_INTLTOOL([0.35.0])
rhughes@241
   270
GETTEXT_PACKAGE=razor
rhughes@241
   271
AC_SUBST([GETTEXT_PACKAGE])
rhughes@241
   272
AM_GLIB_GNU_GETTEXT
rhughes@241
   273
AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[gettext domain])
rhughes@241
   274
krh@262
   275
GTK_DOC_CHECK([1.9])
krh@262
   276
rhughes@241
   277
AC_OUTPUT([
rhughes@241
   278
Makefile
rhughes@241
   279
data/razor.pc
rhughes@241
   280
data/Makefile
rhughes@241
   281
librazor/Makefile
ali@364
   282
librazor/types/Makefile
rhughes@241
   283
src/Makefile
rhughes@241
   284
docs/Makefile
krh@262
   285
docs/version.xml
rhughes@241
   286
po/Makefile.in
ali@323
   287
gl/Makefile
ali@351
   288
test/Makefile
rhughes@241
   289
])
rhughes@241
   290
rhughes@241
   291
dnl ==========================================================================
rhughes@241
   292
echo "
rhughes@241
   293
                  razor $VERSION
rhughes@241
   294
                =================
rhughes@241
   295
rhughes@241
   296
        prefix:                     ${prefix}
rhughes@241
   297
        libdir:                     ${libdir}
rhughes@241
   298
        libexecdir:                 ${libexecdir}
rhughes@241
   299
        bindir:                     ${bindir}
rhughes@241
   300
        sbindir:                    ${sbindir}
rhughes@241
   301
        datadir:                    ${datadir}
rhughes@241
   302
        sysconfdir:                 ${sysconfdir}
rhughes@241
   303
        localstatedir:              ${localstatedir}
rhughes@241
   304
        docdir:                     ${docdir}
rhughes@241
   305
rhughes@241
   306
        compiler:                   ${CC}
rhughes@241
   307
        cflags:                     ${CFLAGS}
rhughes@241
   308
        Maintainer mode:            ${USE_MAINTAINER_MODE}
rhughes@241
   309
        Building verbose mode:      ${enable_verbose_mode}
krh@294
   310
        Building gtk-doc:           ${enable_gtk_doc}
rhughes@241
   311
"