configure.ac
author J. Ali Harlow <ali@juiblex.co.uk>
Thu Oct 09 17:27:41 2014 +0100 (2014-10-09)
changeset 455 df914f383f5c
parent 452 06885e558546
child 463 1ca7a49838e9
permissions -rw-r--r--
Support downloading from local repository even without libcurl

Using the --url option of the razor executable, it is possible
to specify a yum repository on the local machine (eg., on installation
media) and import from there, eg.,:

C> razor --url file:///d:/ import-yum

This will be handled by libcurl if available but if not, an internal
copy routine will be used.

Note that if Microsoft's KTM implementation of atomic transactions is
used, then the current directory must support atomic transactions
(also improve error messages for this, and other, cases).
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@443
    13
LT_CURRENT=5
ali@403
    14
LT_REVISION=0
ali@443
    15
LT_AGE=1
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@452
    69
    AC_SUBST([RAZOR_HAVE_ATOMIC_ROLLBACK],
ali@452
    70
      ['#define RAZOR_HAVE_ATOMIC_ROLLBACK 1'])
ali@452
    71
else
ali@452
    72
    AC_SUBST([RAZOR_HAVE_ATOMIC_ROLLBACK],['#undef RAZOR_HAVE_ATOMIC_ROLLBACK'])
ali@416
    73
fi
ali@416
    74
ali@455
    75
AC_ARG_ENABLE([tests],
ali@455
    76
	      [AS_HELP_STRING([--enable-tests],
ali@455
    77
	      		      [install test programs])],
ali@455
    78
	      [],
ali@455
    79
	      [enable_tests=no])
ali@455
    80
AM_CONDITIONAL(INSTALL_TEST_PROGRAMS, test "$enable_tests" = "yes")
ali@455
    81
ali@328
    82
AC_MSG_CHECKING([for Microsoft Windows native API])
ali@328
    83
case $host_os in
ali@328
    84
    *mingw*)	AC_DEFINE([MSWIN_API], 1,
ali@328
    85
		  [Define to 1 to use Microsoft Windows native API.])
ali@455
    86
		EXTRA_LIBS='-lshlwapi -lshell32 -lws2_32'
ali@328
    87
		mswin_api=yes;;
ali@328
    88
    *)		mswin_api=no;;
ali@328
    89
esac
ali@328
    90
AC_MSG_RESULT([$mswin_api])
ali@328
    91
AM_CONDITIONAL(MSWIN_API, test "$mswin_api" = "yes")
ali@335
    92
AC_SUBST(EXTRA_LIBS)
ali@328
    93
ali@416
    94
if test "$enable_atomic" = "yes" -a "$mswin_api" = "yes"; then
ali@403
    95
    AC_MSG_CHECKING([for Microsoft Windows Kernel Transaction Manager])
ali@403
    96
    save_LIBS="$LIBS"
ali@403
    97
    LIBS="-lktmw32 $LIBS"
ali@403
    98
    AC_LINK_IFELSE([AC_LANG_PROGRAM([dnl
ali@403
    99
#include <windows.h>
ali@403
   100
#include <ktmw32.h>
ali@403
   101
], [(void)CreateTransaction(NULL,0,0,0,0,0,NULL);])],
ali@403
   102
      [have_windows_ktm="yes"; EXTRA_LIBS="-lktmw32 $EXTRA_LIBS"],
ali@403
   103
      [have_windows_ktm="no"])
ali@403
   104
    LIBS="$save_LIBS"
ali@403
   105
    AC_MSG_RESULT([$have_windows_ktm])
ali@403
   106
else
ali@403
   107
    have_windows_ktm="no"
ali@403
   108
fi
ali@403
   109
if test "$have_windows_ktm" = "yes"; then
ali@403
   110
    AC_DEFINE([HAVE_WINDOWS_KTM],[1],[Define if Windows KTM is available.])
ali@403
   111
fi
ali@403
   112
rhughes@241
   113
# Taken from dbus
rhughes@241
   114
AC_ARG_ENABLE(ansi,             [  --enable-ansi           enable -ansi -pedantic gcc flags],enable_ansi=$enableval,enable_ansi=no)
rhughes@241
   115
AC_ARG_ENABLE(verbose-mode,     [  --enable-verbose-mode   support verbose debug mode],enable_verbose_mode=$enableval,enable_verbose_mode=$USE_MAINTAINER_MODE)
rhughes@241
   116
rhughes@241
   117
if test "${enable_verbose_mode}" != no; then
rhughes@241
   118
    # To get -rdynamic you pass -export-dynamic to libtool.
rhughes@241
   119
    AC_DEFINE(BUILT_R_DYNAMIC,1,[whether -export-dynamic was passed to libtool])
rhughes@241
   120
    R_DYNAMIC_LDFLAG=-export-dynamic
rhughes@241
   121
else
rhughes@241
   122
    R_DYNAMIC_LDFLAG=
rhughes@241
   123
fi
rhughes@241
   124
AC_SUBST(R_DYNAMIC_LDFLAG)
rhughes@241
   125
rhughes@241
   126
#### gcc warning flags
rhughes@241
   127
rhughes@241
   128
if test "x$GCC" = "xyes"; then
rhughes@241
   129
  changequote(,)dnl
rhughes@241
   130
  case " $CFLAGS " in
rhughes@241
   131
  *[\ \	]-Wall[\ \	]*) ;;
ali@442
   132
  *) CFLAGS="$CFLAGS -Wall -Wno-parentheses" ;;
rhughes@241
   133
  esac
rhughes@241
   134
rhughes@241
   135
  case " $CFLAGS " in
rhughes@241
   136
  *[\ \	]-Wchar-subscripts[\ \	]*) ;;
rhughes@241
   137
  *) CFLAGS="$CFLAGS -Wchar-subscripts" ;;
rhughes@241
   138
  esac
rhughes@241
   139
rhughes@241
   140
  case " $CFLAGS " in
rhughes@241
   141
  *[\ \	]-Wmissing-declarations[\ \	]*) ;;
rhughes@241
   142
  *) CFLAGS="$CFLAGS -Wmissing-declarations" ;;
rhughes@241
   143
  esac
rhughes@241
   144
rhughes@241
   145
  case " $CFLAGS " in
rhughes@241
   146
  *[\ \	]-Wnested-externs[\ \	]*) ;;
rhughes@241
   147
  *) CFLAGS="$CFLAGS -Wnested-externs" ;;
rhughes@241
   148
  esac
rhughes@241
   149
rhughes@241
   150
  case " $CFLAGS " in
rhughes@241
   151
  *[\ \	]-Wcast-align[\ \	]*) ;;
rhughes@241
   152
  *) CFLAGS="$CFLAGS -Wcast-align" ;;
rhughes@241
   153
  esac
rhughes@241
   154
rhughes@241
   155
  case " $CFLAGS " in
rhughes@241
   156
  *[\ \	]-Wformat[\ \	]*) ;;
rhughes@241
   157
  *) CFLAGS="$CFLAGS -Wformat" ;;
rhughes@241
   158
  esac
rhughes@241
   159
rhughes@241
   160
  case " $CFLAGS " in
rhughes@241
   161
  *[\ \	]-Wformat-security[\ \	]*) ;;
rhughes@241
   162
  *) CFLAGS="$CFLAGS -Wformat-security" ;;
rhughes@241
   163
  esac
rhughes@241
   164
rhughes@241
   165
  if test "x$enable_ansi" = "xyes"; then
rhughes@241
   166
    case " $CFLAGS " in
rhughes@241
   167
    *[\ \	]-ansi[\ \	]*) ;;
rhughes@241
   168
    *) CFLAGS="$CFLAGS -ansi" ;;
rhughes@241
   169
    esac
rhughes@241
   170
rhughes@241
   171
    case " $CFLAGS " in
rhughes@241
   172
    *[\ \	]-D_POSIX_C_SOURCE*) ;;
rhughes@241
   173
    *) CFLAGS="$CFLAGS -D_POSIX_C_SOURCE=199309L" ;;
rhughes@241
   174
    esac
rhughes@241
   175
rhughes@241
   176
    case " $CFLAGS " in
rhughes@241
   177
    *[\ \	]-D_BSD_SOURCE[\ \	]*) ;;
rhughes@241
   178
    *) CFLAGS="$CFLAGS -D_BSD_SOURCE" ;;
rhughes@241
   179
    esac
rhughes@241
   180
rhughes@241
   181
    case " $CFLAGS " in
rhughes@241
   182
    *[\ \	]-pedantic[\ \	]*) ;;
rhughes@241
   183
    *) CFLAGS="$CFLAGS -pedantic" ;;
rhughes@241
   184
    esac
rhughes@241
   185
  fi
rhughes@241
   186
  changequote([,])dnl
rhughes@241
   187
fi
rhughes@241
   188
krh@269
   189
krh@269
   190
# gcc default visibility stuff
krh@269
   191
krh@269
   192
have_gcc4=no
krh@269
   193
AC_MSG_CHECKING(for -fvisibility)
krh@269
   194
AC_COMPILE_IFELSE([
krh@269
   195
#if defined(__GNUC__) && (__GNUC__ >= 4)
krh@269
   196
#else
krh@269
   197
#error Need GCC 4.0 for visibility
krh@269
   198
#endif
krh@269
   199
int main () { return 0; } 
krh@269
   200
], have_gcc4=yes)
krh@269
   201
krh@269
   202
if test "x$have_gcc4" = "xyes"; then
krh@269
   203
   CFLAGS="$CFLAGS -fvisibility=hidden"
krh@269
   204
fi
krh@269
   205
AC_MSG_RESULT($have_gcc4)
krh@269
   206
ali@344
   207
REQUIREMENTS=""
ali@321
   208
AC_ARG_WITH([curl],
ali@321
   209
            [AS_HELP_STRING([--without-curl], [disable support for curl])],
ali@321
   210
            [],
ali@321
   211
            [with_curl=yes])
ali@321
   212
          
ali@321
   213
CURL_CFLAGS=
ali@321
   214
CURL_LIBS=
ali@321
   215
AS_IF([test "x$with_curl" != xno],
ali@321
   216
  [PKG_CHECK_MODULES(CURL, [libcurl])
ali@321
   217
   AC_DEFINE([HAVE_CURL], [1], [Define if you have curl])])
rhughes@241
   218
AC_SUBST(CURL_CFLAGS)
rhughes@241
   219
AC_SUBST(CURL_LIBS)
rhughes@241
   220
rhughes@241
   221
ZLIB_LIBS=""
rhughes@241
   222
AC_ARG_WITH(zlib, [  --with-zlib=<dir>       Use zlib from here],
rhughes@241
   223
                      [
rhughes@241
   224
                      zlib=$withval
rhughes@241
   225
                      CPPFLAGS="$CPPFLAGS -I$withval/include"
rhughes@241
   226
                      ]
rhughes@241
   227
                      )
rhughes@241
   228
AC_CHECK_HEADERS(zlib.h, [AC_DEFINE(HAVE_ZLIB_H)],
rhughes@241
   229
                 [AC_MSG_ERROR([Can't find zlib.h. Please install zlib.])])
ali@344
   230
save_ldflags="$LDFLAGS"
ali@344
   231
LDFLAGS="$LDFLAGS -L$zlib/lib"
ali@344
   232
AC_CHECK_LIB(z, inflate, [ZLIB_LIBS="-L$zlib/lib -lz"],
rhughes@241
   233
	     [AC_MSG_ERROR([Can't find zlib library. Please install zlib.])])
ali@344
   234
LDFLAGS="$save_ldflags"
rhughes@241
   235
AC_SUBST(ZLIB_LIBS)
rhughes@241
   236
rhughes@241
   237
EXPAT_LIB=""
rhughes@241
   238
AC_ARG_WITH(expat, [  --with-expat=<dir>      Use expat from here],
rhughes@241
   239
                      [
rhughes@241
   240
                      expat=$withval
rhughes@241
   241
                      CPPFLAGS="$CPPFLAGS -I$withval/include"
rhughes@241
   242
                      ]
rhughes@241
   243
                      )
rhughes@241
   244
AC_CHECK_HEADERS(expat.h, [AC_DEFINE(HAVE_EXPAT_H)], 
rhughes@241
   245
		 [AC_MSG_ERROR([Can't find expat.h. Please install expat.])])
ali@344
   246
save_ldflags="$LDFLAGS"
ali@344
   247
LDFLAGS="$LDFLAGS -L$expat/lib"
ali@344
   248
AC_CHECK_LIB(expat, XML_ParserCreate, [EXPAT_LIBS="-L$expat/lib -lexpat"],
rhughes@241
   249
	     [AC_MSG_ERROR([Can't find expat library. Please install expat.])])
ali@344
   250
LDFLAGS="$save_ldflags"
rhughes@241
   251
AC_SUBST(EXPAT_LIBS)
rhughes@241
   252
ali@320
   253
RPM_LIBS=""
ali@320
   254
AC_ARG_WITH(rpm, [  --with-rpm=<dir>      Use rpm from here])
ali@320
   255
ali@320
   256
AS_IF([test "$with_rpm" != no],
ali@320
   257
      [if test "$with_rpm" != yes; then
ali@320
   258
	    CPPFLAGS="$CPPFLAGS -I$with_rpm/include"
ali@320
   259
       fi
ali@320
   260
       AC_CHECK_HEADERS(rpm/rpmlib.h, [], 
ali@320
   261
		 [AC_MSG_ERROR([Can't find rpm/rpmlib.h. Please install rpm-devel or use --without-rpm.])])
ali@344
   262
       save_ldflags="$LDFLAGS"
ali@344
   263
       LDFLAGS="$LDFLAGS -L$with_rpm/lib"
ali@344
   264
       AC_CHECK_LIB(rpm,rpmdbOpen,[RPM_LIBS="-L$with_rpm/lib -lrpm"],
ali@320
   265
	     [AC_MSG_ERROR([Can't find rpm library. Please install rpm-devel or use --without-rpm.])])
ali@344
   266
       LDFLAGS="$save_ldflags"
ali@320
   267
       AC_DEFINE([HAVE_RPMLIB], [1], [Define if you have librpm])])
rhughes@241
   268
AC_SUBST(RPM_LIBS)
ali@320
   269
AM_CONDITIONAL([HAVE_RPMLIB], [test -n "$RPM_LIBS"])
ali@352
   270
ali@352
   271
AC_ARG_WITH([lua],
ali@352
   272
            [AS_HELP_STRING([--without-lua], [disable support for lua])],
ali@352
   273
            [],
ali@352
   274
            [with_lua=yes])
ali@428
   275
ali@352
   276
AS_IF([test "x$with_lua" != xno],
ali@352
   277
  [PKG_CHECK_MODULES(LUA, [lua])
ali@352
   278
   REQUIREMENTS="$REQUIREMENTS lua"
ali@352
   279
   AC_DEFINE([HAVE_LUA], [1], [Define if you have lua])
ali@352
   280
   AC_PATH_PROG(LUA, [lua], [no])
ali@352
   281
   AS_IF([test "x$LUA" = xno],
ali@352
   282
     [AC_MSG_ERROR([Can't find lua program. Please install lua-devel or use --without-lua.])])
ali@352
   283
   AC_DEFINE_UNQUOTED([LUA_BINARY], ["$LUA"],
ali@352
   284
     [Define to the location of the lua binary])])
ali@352
   285
AC_SUBST(LUA_CFLAGS)
ali@352
   286
AC_SUBST(LUA_LIBS)
ali@352
   287
AM_CONDITIONAL([HAVE_LUA], [test "x$with_lua" != xno])
ali@352
   288
ali@344
   289
AC_SUBST(REQUIREMENTS)
rhughes@241
   290
rhughes@241
   291
if test "x$GCC" = "xyes"; then
rhughes@241
   292
  LDFLAGS="-Wl,--as-needed $LDFLAGS"
rhughes@241
   293
fi
rhughes@241
   294
rhughes@241
   295
# *****************************
rhughes@241
   296
# Make available to Makefile.am
rhughes@241
   297
# *****************************
rhughes@241
   298
AC_SUBST(SYSCONFDIR, $sysconfdir)
rhughes@241
   299
rhughes@241
   300
# ********************
rhughes@241
   301
# Internationalisation
rhughes@241
   302
# ********************
rhughes@241
   303
ali@319
   304
IT_PROG_INTLTOOL([0.35.0])
rhughes@241
   305
GETTEXT_PACKAGE=razor
rhughes@241
   306
AC_SUBST([GETTEXT_PACKAGE])
rhughes@241
   307
AM_GLIB_GNU_GETTEXT
rhughes@241
   308
AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[gettext domain])
rhughes@241
   309
krh@262
   310
GTK_DOC_CHECK([1.9])
krh@262
   311
rhughes@241
   312
AC_OUTPUT([
rhughes@241
   313
Makefile
rhughes@241
   314
data/razor.pc
rhughes@241
   315
data/Makefile
rhughes@241
   316
librazor/Makefile
ali@452
   317
librazor/razor.h
ali@364
   318
librazor/types/Makefile
rhughes@241
   319
src/Makefile
rhughes@241
   320
docs/Makefile
krh@262
   321
docs/version.xml
rhughes@241
   322
po/Makefile.in
ali@323
   323
gl/Makefile
ali@351
   324
test/Makefile
rhughes@241
   325
])
rhughes@241
   326
rhughes@241
   327
dnl ==========================================================================
rhughes@241
   328
echo "
rhughes@241
   329
                  razor $VERSION
rhughes@241
   330
                =================
rhughes@241
   331
rhughes@241
   332
        prefix:                     ${prefix}
rhughes@241
   333
        libdir:                     ${libdir}
rhughes@241
   334
        libexecdir:                 ${libexecdir}
rhughes@241
   335
        bindir:                     ${bindir}
rhughes@241
   336
        sbindir:                    ${sbindir}
rhughes@241
   337
        datadir:                    ${datadir}
rhughes@241
   338
        sysconfdir:                 ${sysconfdir}
rhughes@241
   339
        localstatedir:              ${localstatedir}
rhughes@241
   340
        docdir:                     ${docdir}
rhughes@241
   341
rhughes@241
   342
        compiler:                   ${CC}
rhughes@241
   343
        cflags:                     ${CFLAGS}
rhughes@241
   344
        Maintainer mode:            ${USE_MAINTAINER_MODE}
rhughes@241
   345
        Building verbose mode:      ${enable_verbose_mode}
krh@294
   346
        Building gtk-doc:           ${enable_gtk_doc}
rhughes@241
   347
"