configure.ac
author J. Ali Harlow <ali@juiblex.co.uk>
Wed Apr 29 17:00:01 2009 +0100 (2009-04-29)
changeset 361 2523d03a840e
parent 354 889f5ff1aaa6
child 364 66ec30bde5e5
permissions -rw-r--r--
Add support for preloading lua modules. This is useful both when
providing lua bindings to applications based on librazor and when
producing static binaries using librazor (where otherwise the lua
POSIX library would need to be included as an additional dynamic
object).
     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 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_MSG_CHECKING([for Microsoft Windows native API])
    37 case $host_os in
    38     *mingw*)	AC_DEFINE([MSWIN_API], 1,
    39 		  [Define to 1 to use Microsoft Windows native API.])
    40 		EXTRA_LIBS='-lshell32 -lws2_32'
    41 		mswin_api=yes;;
    42     *)		mswin_api=no;;
    43 esac
    44 AC_MSG_RESULT([$mswin_api])
    45 AM_CONDITIONAL(MSWIN_API, test "$mswin_api" = "yes")
    46 AC_SUBST(EXTRA_LIBS)
    47 
    48 # Taken from dbus
    49 AC_ARG_ENABLE(ansi,             [  --enable-ansi           enable -ansi -pedantic gcc flags],enable_ansi=$enableval,enable_ansi=no)
    50 AC_ARG_ENABLE(verbose-mode,     [  --enable-verbose-mode   support verbose debug mode],enable_verbose_mode=$enableval,enable_verbose_mode=$USE_MAINTAINER_MODE)
    51 
    52 if test "${enable_verbose_mode}" != no; then
    53     # To get -rdynamic you pass -export-dynamic to libtool.
    54     AC_DEFINE(BUILT_R_DYNAMIC,1,[whether -export-dynamic was passed to libtool])
    55     R_DYNAMIC_LDFLAG=-export-dynamic
    56 else
    57     R_DYNAMIC_LDFLAG=
    58 fi
    59 AC_SUBST(R_DYNAMIC_LDFLAG)
    60 
    61 #### gcc warning flags
    62 
    63 if test "x$GCC" = "xyes"; then
    64   changequote(,)dnl
    65   case " $CFLAGS " in
    66   *[\ \	]-Wall[\ \	]*) ;;
    67   *) CFLAGS="$CFLAGS -Wall" ;;
    68   esac
    69 
    70   case " $CFLAGS " in
    71   *[\ \	]-Wchar-subscripts[\ \	]*) ;;
    72   *) CFLAGS="$CFLAGS -Wchar-subscripts" ;;
    73   esac
    74 
    75   case " $CFLAGS " in
    76   *[\ \	]-Wmissing-declarations[\ \	]*) ;;
    77   *) CFLAGS="$CFLAGS -Wmissing-declarations" ;;
    78   esac
    79 
    80   case " $CFLAGS " in
    81   *[\ \	]-Wnested-externs[\ \	]*) ;;
    82   *) CFLAGS="$CFLAGS -Wnested-externs" ;;
    83   esac
    84 
    85   case " $CFLAGS " in
    86   *[\ \	]-Wcast-align[\ \	]*) ;;
    87   *) CFLAGS="$CFLAGS -Wcast-align" ;;
    88   esac
    89 
    90   case " $CFLAGS " in
    91   *[\ \	]-Wformat[\ \	]*) ;;
    92   *) CFLAGS="$CFLAGS -Wformat" ;;
    93   esac
    94 
    95   case " $CFLAGS " in
    96   *[\ \	]-Wformat-security[\ \	]*) ;;
    97   *) CFLAGS="$CFLAGS -Wformat-security" ;;
    98   esac
    99 
   100   if test "x$enable_ansi" = "xyes"; then
   101     case " $CFLAGS " in
   102     *[\ \	]-ansi[\ \	]*) ;;
   103     *) CFLAGS="$CFLAGS -ansi" ;;
   104     esac
   105 
   106     case " $CFLAGS " in
   107     *[\ \	]-D_POSIX_C_SOURCE*) ;;
   108     *) CFLAGS="$CFLAGS -D_POSIX_C_SOURCE=199309L" ;;
   109     esac
   110 
   111     case " $CFLAGS " in
   112     *[\ \	]-D_BSD_SOURCE[\ \	]*) ;;
   113     *) CFLAGS="$CFLAGS -D_BSD_SOURCE" ;;
   114     esac
   115 
   116     case " $CFLAGS " in
   117     *[\ \	]-pedantic[\ \	]*) ;;
   118     *) CFLAGS="$CFLAGS -pedantic" ;;
   119     esac
   120   fi
   121   changequote([,])dnl
   122 fi
   123 
   124 
   125 # gcc default visibility stuff
   126 
   127 have_gcc4=no
   128 AC_MSG_CHECKING(for -fvisibility)
   129 AC_COMPILE_IFELSE([
   130 #if defined(__GNUC__) && (__GNUC__ >= 4)
   131 #else
   132 #error Need GCC 4.0 for visibility
   133 #endif
   134 int main () { return 0; } 
   135 ], have_gcc4=yes)
   136 
   137 if test "x$have_gcc4" = "xyes"; then
   138    CFLAGS="$CFLAGS -fvisibility=hidden"
   139 fi
   140 AC_MSG_RESULT($have_gcc4)
   141 
   142 REQUIREMENTS=""
   143 AC_ARG_WITH([curl],
   144             [AS_HELP_STRING([--without-curl], [disable support for curl])],
   145             [],
   146             [with_curl=yes])
   147           
   148 CURL_CFLAGS=
   149 CURL_LIBS=
   150 AS_IF([test "x$with_curl" != xno],
   151   [PKG_CHECK_MODULES(CURL, [libcurl])
   152    AC_DEFINE([HAVE_CURL], [1], [Define if you have curl])])
   153 AC_SUBST(CURL_CFLAGS)
   154 AC_SUBST(CURL_LIBS)
   155 
   156 ZLIB_LIBS=""
   157 AC_ARG_WITH(zlib, [  --with-zlib=<dir>       Use zlib from here],
   158                       [
   159                       zlib=$withval
   160                       CPPFLAGS="$CPPFLAGS -I$withval/include"
   161                       ]
   162                       )
   163 AC_CHECK_HEADERS(zlib.h, [AC_DEFINE(HAVE_ZLIB_H)],
   164                  [AC_MSG_ERROR([Can't find zlib.h. Please install zlib.])])
   165 save_ldflags="$LDFLAGS"
   166 LDFLAGS="$LDFLAGS -L$zlib/lib"
   167 AC_CHECK_LIB(z, inflate, [ZLIB_LIBS="-L$zlib/lib -lz"],
   168 	     [AC_MSG_ERROR([Can't find zlib library. Please install zlib.])])
   169 LDFLAGS="$save_ldflags"
   170 AC_SUBST(ZLIB_LIBS)
   171 
   172 EXPAT_LIB=""
   173 AC_ARG_WITH(expat, [  --with-expat=<dir>      Use expat from here],
   174                       [
   175                       expat=$withval
   176                       CPPFLAGS="$CPPFLAGS -I$withval/include"
   177                       ]
   178                       )
   179 AC_CHECK_HEADERS(expat.h, [AC_DEFINE(HAVE_EXPAT_H)], 
   180 		 [AC_MSG_ERROR([Can't find expat.h. Please install expat.])])
   181 save_ldflags="$LDFLAGS"
   182 LDFLAGS="$LDFLAGS -L$expat/lib"
   183 AC_CHECK_LIB(expat, XML_ParserCreate, [EXPAT_LIBS="-L$expat/lib -lexpat"],
   184 	     [AC_MSG_ERROR([Can't find expat library. Please install expat.])])
   185 LDFLAGS="$save_ldflags"
   186 AC_SUBST(EXPAT_LIBS)
   187 
   188 RPM_LIBS=""
   189 AC_ARG_WITH(rpm, [  --with-rpm=<dir>      Use rpm from here])
   190 
   191 AS_IF([test "$with_rpm" != no],
   192       [if test "$with_rpm" != yes; then
   193 	    CPPFLAGS="$CPPFLAGS -I$with_rpm/include"
   194        fi
   195        AC_CHECK_HEADERS(rpm/rpmlib.h, [], 
   196 		 [AC_MSG_ERROR([Can't find rpm/rpmlib.h. Please install rpm-devel or use --without-rpm.])])
   197        save_ldflags="$LDFLAGS"
   198        LDFLAGS="$LDFLAGS -L$with_rpm/lib"
   199        AC_CHECK_LIB(rpm,rpmdbOpen,[RPM_LIBS="-L$with_rpm/lib -lrpm"],
   200 	     [AC_MSG_ERROR([Can't find rpm library. Please install rpm-devel or use --without-rpm.])])
   201        LDFLAGS="$save_ldflags"
   202        AC_DEFINE([HAVE_RPMLIB], [1], [Define if you have librpm])])
   203 AC_SUBST(RPM_LIBS)
   204 AM_CONDITIONAL([HAVE_RPMLIB], [test -n "$RPM_LIBS"])
   205 
   206 AC_ARG_WITH([lua],
   207             [AS_HELP_STRING([--without-lua], [disable support for lua])],
   208             [],
   209             [with_lua=yes])
   210           
   211 LUA_CFLAGS=
   212 LUA_LIBS=
   213 AS_IF([test "x$with_lua" != xno],
   214   [PKG_CHECK_MODULES(LUA, [lua])
   215    REQUIREMENTS="$REQUIREMENTS lua"
   216    AC_DEFINE([HAVE_LUA], [1], [Define if you have lua])
   217    AC_PATH_PROG(LUA, [lua], [no])
   218    AS_IF([test "x$LUA" = xno],
   219      [AC_MSG_ERROR([Can't find lua program. Please install lua-devel or use --without-lua.])])
   220    AC_DEFINE_UNQUOTED([LUA_BINARY], ["$LUA"],
   221      [Define to the location of the lua binary])])
   222 AC_SUBST(LUA_CFLAGS)
   223 AC_SUBST(LUA_LIBS)
   224 AM_CONDITIONAL([HAVE_LUA], [test "x$with_lua" != xno])
   225 
   226 AC_SUBST(REQUIREMENTS)
   227 
   228 if test "x$GCC" = "xyes"; then
   229   LDFLAGS="-Wl,--as-needed $LDFLAGS"
   230 fi
   231 
   232 # *****************************
   233 # Make available to Makefile.am
   234 # *****************************
   235 AC_SUBST(SYSCONFDIR, $sysconfdir)
   236 
   237 # ********************
   238 # Internationalisation
   239 # ********************
   240 
   241 IT_PROG_INTLTOOL([0.35.0])
   242 GETTEXT_PACKAGE=razor
   243 AC_SUBST([GETTEXT_PACKAGE])
   244 AM_GLIB_GNU_GETTEXT
   245 AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[gettext domain])
   246 
   247 GTK_DOC_CHECK([1.9])
   248 
   249 AC_OUTPUT([
   250 Makefile
   251 data/razor.pc
   252 data/Makefile
   253 librazor/Makefile
   254 src/Makefile
   255 docs/Makefile
   256 docs/version.xml
   257 po/Makefile.in
   258 gl/Makefile
   259 test/Makefile
   260 ])
   261 
   262 dnl ==========================================================================
   263 echo "
   264                   razor $VERSION
   265                 =================
   266 
   267         prefix:                     ${prefix}
   268         libdir:                     ${libdir}
   269         libexecdir:                 ${libexecdir}
   270         bindir:                     ${bindir}
   271         sbindir:                    ${sbindir}
   272         datadir:                    ${datadir}
   273         sysconfdir:                 ${sysconfdir}
   274         localstatedir:              ${localstatedir}
   275         docdir:                     ${docdir}
   276 
   277         compiler:                   ${CC}
   278         cflags:                     ${CFLAGS}
   279         Maintainer mode:            ${USE_MAINTAINER_MODE}
   280         Building verbose mode:      ${enable_verbose_mode}
   281         Building gtk-doc:           ${enable_gtk_doc}
   282 "