configure.ac
author J. Ali Harlow <ali@juiblex.co.uk>
Thu Jan 08 14:35:18 2009 +0000 (2009-01-08)
changeset 328 45ea57d83f28
parent 327 c85643dd7164
child 330 2af301268803
permissions -rw-r--r--
Don't attempt to use chroot() on systems that don't support it.

This has the added bonus of allowing us to use popen() rather than
fork()/exec() for improved portability. Of course, the loss of an
install root is a major reduction of functionality but it's hard to
see what else we could substitute for chroot().
     1 dnl Process this file with autoconf to produce a configure script.
     2 
     3 AC_PREREQ(2.59c)
     4 AC_INIT(razor, 0.1, krh@redhat.com)
     5 AM_INIT_AUTOMAKE(razor, 0.1)
     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=1
    14 LT_REVISION=0
    15 LT_AGE=0
    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_CHECK_HEADERS([sys/mman.h])
    26 gl_INIT
    27 AC_CHECK_FUNCS([symlink chroot])
    28 AM_PROG_LIBTOOL
    29 AC_PROG_MAKE_SET
    30 AC_PROG_LN_S
    31 AC_SYS_LARGEFILE
    32 AM_PROG_CC_C_O
    33 
    34 AC_MSG_CHECKING([for Microsoft Windows native API])
    35 case $host_os in
    36     *mingw*)	AC_DEFINE([MSWIN_API], 1,
    37 		  [Define to 1 to use Microsoft Windows native API.])
    38 		mswin_api=yes;;
    39     *)		mswin_api=no;;
    40 esac
    41 AC_MSG_RESULT([$mswin_api])
    42 AM_CONDITIONAL(MSWIN_API, test "$mswin_api" = "yes")
    43 
    44 # Taken from dbus
    45 AC_ARG_ENABLE(ansi,             [  --enable-ansi           enable -ansi -pedantic gcc flags],enable_ansi=$enableval,enable_ansi=no)
    46 AC_ARG_ENABLE(verbose-mode,     [  --enable-verbose-mode   support verbose debug mode],enable_verbose_mode=$enableval,enable_verbose_mode=$USE_MAINTAINER_MODE)
    47 
    48 if test "${enable_verbose_mode}" != no; then
    49     # To get -rdynamic you pass -export-dynamic to libtool.
    50     AC_DEFINE(BUILT_R_DYNAMIC,1,[whether -export-dynamic was passed to libtool])
    51     R_DYNAMIC_LDFLAG=-export-dynamic
    52 else
    53     R_DYNAMIC_LDFLAG=
    54 fi
    55 AC_SUBST(R_DYNAMIC_LDFLAG)
    56 
    57 #### gcc warning flags
    58 
    59 if test "x$GCC" = "xyes"; then
    60   changequote(,)dnl
    61   case " $CFLAGS " in
    62   *[\ \	]-Wall[\ \	]*) ;;
    63   *) CFLAGS="$CFLAGS -Wall" ;;
    64   esac
    65 
    66   case " $CFLAGS " in
    67   *[\ \	]-Wchar-subscripts[\ \	]*) ;;
    68   *) CFLAGS="$CFLAGS -Wchar-subscripts" ;;
    69   esac
    70 
    71   case " $CFLAGS " in
    72   *[\ \	]-Wmissing-declarations[\ \	]*) ;;
    73   *) CFLAGS="$CFLAGS -Wmissing-declarations" ;;
    74   esac
    75 
    76   case " $CFLAGS " in
    77   *[\ \	]-Wnested-externs[\ \	]*) ;;
    78   *) CFLAGS="$CFLAGS -Wnested-externs" ;;
    79   esac
    80 
    81   case " $CFLAGS " in
    82   *[\ \	]-Wcast-align[\ \	]*) ;;
    83   *) CFLAGS="$CFLAGS -Wcast-align" ;;
    84   esac
    85 
    86   case " $CFLAGS " in
    87   *[\ \	]-Wformat[\ \	]*) ;;
    88   *) CFLAGS="$CFLAGS -Wformat" ;;
    89   esac
    90 
    91   case " $CFLAGS " in
    92   *[\ \	]-Wformat-security[\ \	]*) ;;
    93   *) CFLAGS="$CFLAGS -Wformat-security" ;;
    94   esac
    95 
    96   if test "x$enable_ansi" = "xyes"; then
    97     case " $CFLAGS " in
    98     *[\ \	]-ansi[\ \	]*) ;;
    99     *) CFLAGS="$CFLAGS -ansi" ;;
   100     esac
   101 
   102     case " $CFLAGS " in
   103     *[\ \	]-D_POSIX_C_SOURCE*) ;;
   104     *) CFLAGS="$CFLAGS -D_POSIX_C_SOURCE=199309L" ;;
   105     esac
   106 
   107     case " $CFLAGS " in
   108     *[\ \	]-D_BSD_SOURCE[\ \	]*) ;;
   109     *) CFLAGS="$CFLAGS -D_BSD_SOURCE" ;;
   110     esac
   111 
   112     case " $CFLAGS " in
   113     *[\ \	]-pedantic[\ \	]*) ;;
   114     *) CFLAGS="$CFLAGS -pedantic" ;;
   115     esac
   116   fi
   117   changequote([,])dnl
   118 fi
   119 
   120 
   121 # gcc default visibility stuff
   122 
   123 have_gcc4=no
   124 AC_MSG_CHECKING(for -fvisibility)
   125 AC_COMPILE_IFELSE([
   126 #if defined(__GNUC__) && (__GNUC__ >= 4)
   127 #else
   128 #error Need GCC 4.0 for visibility
   129 #endif
   130 int main () { return 0; } 
   131 ], have_gcc4=yes)
   132 
   133 if test "x$have_gcc4" = "xyes"; then
   134    CFLAGS="$CFLAGS -fvisibility=hidden"
   135 fi
   136 AC_MSG_RESULT($have_gcc4)
   137 
   138 
   139 AC_ARG_WITH([curl],
   140             [AS_HELP_STRING([--without-curl], [disable support for curl])],
   141             [],
   142             [with_curl=yes])
   143           
   144 CURL_CFLAGS=
   145 CURL_LIBS=
   146 AS_IF([test "x$with_curl" != xno],
   147   [PKG_CHECK_MODULES(CURL, [libcurl])
   148    AC_DEFINE([HAVE_CURL], [1], [Define if you have curl])])
   149 AC_SUBST(CURL_CFLAGS)
   150 AC_SUBST(CURL_LIBS)
   151 
   152 ZLIB_LIBS=""
   153 AC_ARG_WITH(zlib, [  --with-zlib=<dir>       Use zlib from here],
   154                       [
   155                       zlib=$withval
   156                       CPPFLAGS="$CPPFLAGS -I$withval/include"
   157                       LDFLAGS="$LDFLAGS -L$withval/lib"
   158                       ]
   159                       )
   160 AC_CHECK_HEADERS(zlib.h, [AC_DEFINE(HAVE_ZLIB_H)],
   161                  [AC_MSG_ERROR([Can't find zlib.h. Please install zlib.])])
   162 AC_CHECK_LIB(z, inflate, [ZLIB_LIBS="-lz"],
   163 	     [AC_MSG_ERROR([Can't find zlib library. Please install zlib.])])
   164 AC_SUBST(ZLIB_LIBS)
   165 
   166 EXPAT_LIB=""
   167 AC_ARG_WITH(expat, [  --with-expat=<dir>      Use expat from here],
   168                       [
   169                       expat=$withval
   170                       CPPFLAGS="$CPPFLAGS -I$withval/include"
   171                       LDFLAGS="$LDFLAGS -L$withval/lib"
   172                       ]
   173                       )
   174 AC_CHECK_HEADERS(expat.h, [AC_DEFINE(HAVE_EXPAT_H)], 
   175 		 [AC_MSG_ERROR([Can't find expat.h. Please install expat.])])
   176 AC_CHECK_LIB(expat, XML_ParserCreate, [EXPAT_LIBS="-lexpat"],
   177 	     [AC_MSG_ERROR([Can't find expat library. Please install expat.])])
   178 AC_SUBST(EXPAT_LIBS)
   179 
   180 RPM_LIBS=""
   181 AC_ARG_WITH(rpm, [  --with-rpm=<dir>      Use rpm from here])
   182 
   183 AS_IF([test "$with_rpm" != no],
   184       [if test "$with_rpm" != yes; then
   185 	    CPPFLAGS="$CPPFLAGS -I$with_rpm/include"
   186             LDFLAGS="$LDFLAGS -L$with_rpm/lib"
   187        fi
   188        AC_CHECK_HEADERS(rpm/rpmlib.h, [], 
   189 		 [AC_MSG_ERROR([Can't find rpm/rpmlib.h. Please install rpm-devel or use --without-rpm.])])
   190        AC_CHECK_LIB(rpm,rpmdbOpen,[RPM_LIBS="-lrpm"],
   191 	     [AC_MSG_ERROR([Can't find rpm library. Please install rpm-devel or use --without-rpm.])])
   192        AC_DEFINE([HAVE_RPMLIB], [1], [Define if you have librpm])])
   193 AC_SUBST(RPM_LIBS)
   194 AM_CONDITIONAL([HAVE_RPMLIB], [test -n "$RPM_LIBS"])
   195 
   196 if test "x$GCC" = "xyes"; then
   197   LDFLAGS="-Wl,--as-needed $LDFLAGS"
   198 fi
   199 
   200 # *****************************
   201 # Make available to Makefile.am
   202 # *****************************
   203 AC_SUBST(SYSCONFDIR, $sysconfdir)
   204 
   205 # ********************
   206 # Internationalisation
   207 # ********************
   208 
   209 IT_PROG_INTLTOOL([0.35.0])
   210 GETTEXT_PACKAGE=razor
   211 AC_SUBST([GETTEXT_PACKAGE])
   212 AM_GLIB_GNU_GETTEXT
   213 AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[gettext domain])
   214 
   215 GTK_DOC_CHECK([1.9])
   216 
   217 AC_OUTPUT([
   218 Makefile
   219 data/razor.pc
   220 data/Makefile
   221 librazor/Makefile
   222 src/Makefile
   223 docs/Makefile
   224 docs/version.xml
   225 po/Makefile.in
   226 gl/Makefile
   227 ])
   228 
   229 dnl ==========================================================================
   230 echo "
   231                   razor $VERSION
   232                 =================
   233 
   234         prefix:                     ${prefix}
   235         libdir:                     ${libdir}
   236         libexecdir:                 ${libexecdir}
   237         bindir:                     ${bindir}
   238         sbindir:                    ${sbindir}
   239         datadir:                    ${datadir}
   240         sysconfdir:                 ${sysconfdir}
   241         localstatedir:              ${localstatedir}
   242         docdir:                     ${docdir}
   243 
   244         compiler:                   ${CC}
   245         cflags:                     ${CFLAGS}
   246         Maintainer mode:            ${USE_MAINTAINER_MODE}
   247         Building verbose mode:      ${enable_verbose_mode}
   248         Building gtk-doc:           ${enable_gtk_doc}
   249 "