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