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