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