configure.ac
author J. Ali Harlow <ali@juiblex.co.uk>
Thu Feb 09 20:45:27 2012 +0000 (2012-02-09)
changeset 418 33b825d3128d
parent 416 d0aa9e0a6d04
child 420 a7a1be2fed47
permissions -rw-r--r--
Add transaction barriers
These allow packages to be installed and removed which have scripts
that depend on each other when atomic transactions are involved.
Note that yum supports pre, but not other requires flags. post will
need similar support to the post scripts themselves pulling in the
requires flags from the rpms. Likewise preun and postun will need
similar handling to those scrips since the requires flags will need
to be stored in the razor database.
     1 dnl Process this file with autoconf to produce a configure script.
     2 
     3 AC_PREREQ(2.59c)
     4 AC_INIT([razor], [0.5.3], [ali@juiblex.co.uk])
     5 AM_INIT_AUTOMAKE([])
     6 AM_CONFIG_HEADER([config.h])
     7 AM_MAINTAINER_MODE
     8 
     9 # libtool versioning - this applies to all libraries in this package
    10 #
    11 # See http://sources.redhat.com/autobook/autobook/autobook_91.html#SEC91 for details
    12 #
    13 LT_CURRENT=3
    14 LT_REVISION=0
    15 LT_AGE=1
    16 AC_SUBST(LT_CURRENT)
    17 AC_SUBST(LT_REVISION)
    18 AC_SUBST(LT_AGE)
    19 
    20 AC_ISC_POSIX
    21 AC_PROG_CC
    22 gl_EARLY
    23 AM_PROG_CC_STDC
    24 AC_HEADER_STDC
    25 AC_HEADER_SYS_WAIT
    26 AC_CHECK_HEADERS([sys/mman.h])
    27 gl_INIT
    28 AC_CHECK_FUNCS([symlink chroot])
    29 AC_LIBTOOL_WIN32_DLL
    30 AM_PROG_LIBTOOL
    31 AC_PROG_MAKE_SET
    32 AC_PROG_LN_S
    33 AC_SYS_LARGEFILE
    34 AM_PROG_CC_C_O
    35 
    36 AC_ARG_ENABLE([atomic],
    37 	      [AS_HELP_STRING([--disable-atomic],
    38 	      		      [disable atomic transactions])],
    39 	      [],
    40 	      [enable_atomic=yes])
    41 if test "$enable_atomic" = "yes"; then
    42     AC_DEFINE([ENABLE_ATOMIC],[1],[Define if atomic transactions are wanted.])
    43 fi
    44 
    45 AC_MSG_CHECKING([for Microsoft Windows native API])
    46 case $host_os in
    47     *mingw*)	AC_DEFINE([MSWIN_API], 1,
    48 		  [Define to 1 to use Microsoft Windows native API.])
    49 		EXTRA_LIBS='-lshell32 -lws2_32'
    50 		mswin_api=yes;;
    51     *)		mswin_api=no;;
    52 esac
    53 AC_MSG_RESULT([$mswin_api])
    54 AM_CONDITIONAL(MSWIN_API, test "$mswin_api" = "yes")
    55 AC_SUBST(EXTRA_LIBS)
    56 
    57 if test "$enable_atomic" = "yes" -a "$mswin_api" = "yes"; then
    58     AC_MSG_CHECKING([for Microsoft Windows Kernel Transaction Manager])
    59     save_LIBS="$LIBS"
    60     LIBS="-lktmw32 $LIBS"
    61     AC_LINK_IFELSE([AC_LANG_PROGRAM([dnl
    62 #include <windows.h>
    63 #include <ktmw32.h>
    64 ], [(void)CreateTransaction(NULL,0,0,0,0,0,NULL);])],
    65       [have_windows_ktm="yes"; EXTRA_LIBS="-lktmw32 $EXTRA_LIBS"],
    66       [have_windows_ktm="no"])
    67     LIBS="$save_LIBS"
    68     AC_MSG_RESULT([$have_windows_ktm])
    69 else
    70     have_windows_ktm="no"
    71 fi
    72 if test "$have_windows_ktm" = "yes"; then
    73     AC_DEFINE([HAVE_WINDOWS_KTM],[1],[Define if Windows KTM is available.])
    74 fi
    75 
    76 # Taken from dbus
    77 AC_ARG_ENABLE(ansi,             [  --enable-ansi           enable -ansi -pedantic gcc flags],enable_ansi=$enableval,enable_ansi=no)
    78 AC_ARG_ENABLE(verbose-mode,     [  --enable-verbose-mode   support verbose debug mode],enable_verbose_mode=$enableval,enable_verbose_mode=$USE_MAINTAINER_MODE)
    79 
    80 if test "${enable_verbose_mode}" != no; then
    81     # To get -rdynamic you pass -export-dynamic to libtool.
    82     AC_DEFINE(BUILT_R_DYNAMIC,1,[whether -export-dynamic was passed to libtool])
    83     R_DYNAMIC_LDFLAG=-export-dynamic
    84 else
    85     R_DYNAMIC_LDFLAG=
    86 fi
    87 AC_SUBST(R_DYNAMIC_LDFLAG)
    88 
    89 #### gcc warning flags
    90 
    91 if test "x$GCC" = "xyes"; then
    92   changequote(,)dnl
    93   case " $CFLAGS " in
    94   *[\ \	]-Wall[\ \	]*) ;;
    95   *) CFLAGS="$CFLAGS -Wall" ;;
    96   esac
    97 
    98   case " $CFLAGS " in
    99   *[\ \	]-Wchar-subscripts[\ \	]*) ;;
   100   *) CFLAGS="$CFLAGS -Wchar-subscripts" ;;
   101   esac
   102 
   103   case " $CFLAGS " in
   104   *[\ \	]-Wmissing-declarations[\ \	]*) ;;
   105   *) CFLAGS="$CFLAGS -Wmissing-declarations" ;;
   106   esac
   107 
   108   case " $CFLAGS " in
   109   *[\ \	]-Wnested-externs[\ \	]*) ;;
   110   *) CFLAGS="$CFLAGS -Wnested-externs" ;;
   111   esac
   112 
   113   case " $CFLAGS " in
   114   *[\ \	]-Wcast-align[\ \	]*) ;;
   115   *) CFLAGS="$CFLAGS -Wcast-align" ;;
   116   esac
   117 
   118   case " $CFLAGS " in
   119   *[\ \	]-Wformat[\ \	]*) ;;
   120   *) CFLAGS="$CFLAGS -Wformat" ;;
   121   esac
   122 
   123   case " $CFLAGS " in
   124   *[\ \	]-Wformat-security[\ \	]*) ;;
   125   *) CFLAGS="$CFLAGS -Wformat-security" ;;
   126   esac
   127 
   128   if test "x$enable_ansi" = "xyes"; then
   129     case " $CFLAGS " in
   130     *[\ \	]-ansi[\ \	]*) ;;
   131     *) CFLAGS="$CFLAGS -ansi" ;;
   132     esac
   133 
   134     case " $CFLAGS " in
   135     *[\ \	]-D_POSIX_C_SOURCE*) ;;
   136     *) CFLAGS="$CFLAGS -D_POSIX_C_SOURCE=199309L" ;;
   137     esac
   138 
   139     case " $CFLAGS " in
   140     *[\ \	]-D_BSD_SOURCE[\ \	]*) ;;
   141     *) CFLAGS="$CFLAGS -D_BSD_SOURCE" ;;
   142     esac
   143 
   144     case " $CFLAGS " in
   145     *[\ \	]-pedantic[\ \	]*) ;;
   146     *) CFLAGS="$CFLAGS -pedantic" ;;
   147     esac
   148   fi
   149   changequote([,])dnl
   150 fi
   151 
   152 
   153 # gcc default visibility stuff
   154 
   155 have_gcc4=no
   156 AC_MSG_CHECKING(for -fvisibility)
   157 AC_COMPILE_IFELSE([
   158 #if defined(__GNUC__) && (__GNUC__ >= 4)
   159 #else
   160 #error Need GCC 4.0 for visibility
   161 #endif
   162 int main () { return 0; } 
   163 ], have_gcc4=yes)
   164 
   165 if test "x$have_gcc4" = "xyes"; then
   166    CFLAGS="$CFLAGS -fvisibility=hidden"
   167 fi
   168 AC_MSG_RESULT($have_gcc4)
   169 
   170 REQUIREMENTS=""
   171 AC_ARG_WITH([curl],
   172             [AS_HELP_STRING([--without-curl], [disable support for curl])],
   173             [],
   174             [with_curl=yes])
   175           
   176 CURL_CFLAGS=
   177 CURL_LIBS=
   178 AS_IF([test "x$with_curl" != xno],
   179   [PKG_CHECK_MODULES(CURL, [libcurl])
   180    AC_DEFINE([HAVE_CURL], [1], [Define if you have curl])])
   181 AC_SUBST(CURL_CFLAGS)
   182 AC_SUBST(CURL_LIBS)
   183 
   184 ZLIB_LIBS=""
   185 AC_ARG_WITH(zlib, [  --with-zlib=<dir>       Use zlib from here],
   186                       [
   187                       zlib=$withval
   188                       CPPFLAGS="$CPPFLAGS -I$withval/include"
   189                       ]
   190                       )
   191 AC_CHECK_HEADERS(zlib.h, [AC_DEFINE(HAVE_ZLIB_H)],
   192                  [AC_MSG_ERROR([Can't find zlib.h. Please install zlib.])])
   193 save_ldflags="$LDFLAGS"
   194 LDFLAGS="$LDFLAGS -L$zlib/lib"
   195 AC_CHECK_LIB(z, inflate, [ZLIB_LIBS="-L$zlib/lib -lz"],
   196 	     [AC_MSG_ERROR([Can't find zlib library. Please install zlib.])])
   197 LDFLAGS="$save_ldflags"
   198 AC_SUBST(ZLIB_LIBS)
   199 
   200 EXPAT_LIB=""
   201 AC_ARG_WITH(expat, [  --with-expat=<dir>      Use expat from here],
   202                       [
   203                       expat=$withval
   204                       CPPFLAGS="$CPPFLAGS -I$withval/include"
   205                       ]
   206                       )
   207 AC_CHECK_HEADERS(expat.h, [AC_DEFINE(HAVE_EXPAT_H)], 
   208 		 [AC_MSG_ERROR([Can't find expat.h. Please install expat.])])
   209 save_ldflags="$LDFLAGS"
   210 LDFLAGS="$LDFLAGS -L$expat/lib"
   211 AC_CHECK_LIB(expat, XML_ParserCreate, [EXPAT_LIBS="-L$expat/lib -lexpat"],
   212 	     [AC_MSG_ERROR([Can't find expat library. Please install expat.])])
   213 LDFLAGS="$save_ldflags"
   214 AC_SUBST(EXPAT_LIBS)
   215 
   216 RPM_LIBS=""
   217 AC_ARG_WITH(rpm, [  --with-rpm=<dir>      Use rpm from here])
   218 
   219 AS_IF([test "$with_rpm" != no],
   220       [if test "$with_rpm" != yes; then
   221 	    CPPFLAGS="$CPPFLAGS -I$with_rpm/include"
   222        fi
   223        AC_CHECK_HEADERS(rpm/rpmlib.h, [], 
   224 		 [AC_MSG_ERROR([Can't find rpm/rpmlib.h. Please install rpm-devel or use --without-rpm.])])
   225        save_ldflags="$LDFLAGS"
   226        LDFLAGS="$LDFLAGS -L$with_rpm/lib"
   227        AC_CHECK_LIB(rpm,rpmdbOpen,[RPM_LIBS="-L$with_rpm/lib -lrpm"],
   228 	     [AC_MSG_ERROR([Can't find rpm library. Please install rpm-devel or use --without-rpm.])])
   229        LDFLAGS="$save_ldflags"
   230        AC_DEFINE([HAVE_RPMLIB], [1], [Define if you have librpm])])
   231 AC_SUBST(RPM_LIBS)
   232 AM_CONDITIONAL([HAVE_RPMLIB], [test -n "$RPM_LIBS"])
   233 
   234 AC_ARG_WITH([lua],
   235             [AS_HELP_STRING([--without-lua], [disable support for lua])],
   236             [],
   237             [with_lua=yes])
   238           
   239 LUA_CFLAGS=
   240 LUA_LIBS=
   241 AS_IF([test "x$with_lua" != xno],
   242   [PKG_CHECK_MODULES(LUA, [lua])
   243    REQUIREMENTS="$REQUIREMENTS lua"
   244    AC_DEFINE([HAVE_LUA], [1], [Define if you have lua])
   245    AC_PATH_PROG(LUA, [lua], [no])
   246    AS_IF([test "x$LUA" = xno],
   247      [AC_MSG_ERROR([Can't find lua program. Please install lua-devel or use --without-lua.])])
   248    AC_DEFINE_UNQUOTED([LUA_BINARY], ["$LUA"],
   249      [Define to the location of the lua binary])])
   250 AC_SUBST(LUA_CFLAGS)
   251 AC_SUBST(LUA_LIBS)
   252 AM_CONDITIONAL([HAVE_LUA], [test "x$with_lua" != xno])
   253 
   254 AC_SUBST(REQUIREMENTS)
   255 
   256 if test "x$GCC" = "xyes"; then
   257   LDFLAGS="-Wl,--as-needed $LDFLAGS"
   258 fi
   259 
   260 # *****************************
   261 # Make available to Makefile.am
   262 # *****************************
   263 AC_SUBST(SYSCONFDIR, $sysconfdir)
   264 
   265 # ********************
   266 # Internationalisation
   267 # ********************
   268 
   269 IT_PROG_INTLTOOL([0.35.0])
   270 GETTEXT_PACKAGE=razor
   271 AC_SUBST([GETTEXT_PACKAGE])
   272 AM_GLIB_GNU_GETTEXT
   273 AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[gettext domain])
   274 
   275 GTK_DOC_CHECK([1.9])
   276 
   277 AC_OUTPUT([
   278 Makefile
   279 data/razor.pc
   280 data/Makefile
   281 librazor/Makefile
   282 librazor/types/Makefile
   283 src/Makefile
   284 docs/Makefile
   285 docs/version.xml
   286 po/Makefile.in
   287 gl/Makefile
   288 test/Makefile
   289 ])
   290 
   291 dnl ==========================================================================
   292 echo "
   293                   razor $VERSION
   294                 =================
   295 
   296         prefix:                     ${prefix}
   297         libdir:                     ${libdir}
   298         libexecdir:                 ${libexecdir}
   299         bindir:                     ${bindir}
   300         sbindir:                    ${sbindir}
   301         datadir:                    ${datadir}
   302         sysconfdir:                 ${sysconfdir}
   303         localstatedir:              ${localstatedir}
   304         docdir:                     ${docdir}
   305 
   306         compiler:                   ${CC}
   307         cflags:                     ${CFLAGS}
   308         Maintainer mode:            ${USE_MAINTAINER_MODE}
   309         Building verbose mode:      ${enable_verbose_mode}
   310         Building gtk-doc:           ${enable_gtk_doc}
   311 "