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