configure.ac
author Kristian H?gsberg <krh@redhat.com>
Thu Jun 19 15:09:48 2008 -0400 (2008-06-19)
changeset 246 f92d8239324e
child 262 63644cc28e0b
permissions -rw-r--r--
Handle NULL dirnames when importing rpms into a set.
     1 dnl Process this file with autoconf to produce a configure script.
     2 
     3 AC_PREREQ(2.59c)
     4 AC_INIT(razor, 0.8, 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 AM_PROG_CC_STDC
    23 AC_HEADER_STDC
    24 AM_PROG_LIBTOOL
    25 AC_PROG_MAKE_SET
    26 AC_PROG_LN_S
    27 AC_SYS_LARGEFILE
    28 AM_PROG_CC_C_O
    29 
    30 # Taken from dbus
    31 AC_ARG_ENABLE(ansi,             [  --enable-ansi           enable -ansi -pedantic gcc flags],enable_ansi=$enableval,enable_ansi=no)
    32 AC_ARG_ENABLE(verbose-mode,     [  --enable-verbose-mode   support verbose debug mode],enable_verbose_mode=$enableval,enable_verbose_mode=$USE_MAINTAINER_MODE)
    33 
    34 if test "${enable_verbose_mode}" != no; then
    35     # To get -rdynamic you pass -export-dynamic to libtool.
    36     AC_DEFINE(BUILT_R_DYNAMIC,1,[whether -export-dynamic was passed to libtool])
    37     R_DYNAMIC_LDFLAG=-export-dynamic
    38 else
    39     R_DYNAMIC_LDFLAG=
    40 fi
    41 AC_SUBST(R_DYNAMIC_LDFLAG)
    42 
    43 #### gcc warning flags
    44 
    45 if test "x$GCC" = "xyes"; then
    46   changequote(,)dnl
    47   case " $CFLAGS " in
    48   *[\ \	]-Wall[\ \	]*) ;;
    49   *) CFLAGS="$CFLAGS -Wall" ;;
    50   esac
    51 
    52   case " $CFLAGS " in
    53   *[\ \	]-Wchar-subscripts[\ \	]*) ;;
    54   *) CFLAGS="$CFLAGS -Wchar-subscripts" ;;
    55   esac
    56 
    57   case " $CFLAGS " in
    58   *[\ \	]-Wmissing-declarations[\ \	]*) ;;
    59   *) CFLAGS="$CFLAGS -Wmissing-declarations" ;;
    60   esac
    61 
    62   case " $CFLAGS " in
    63   *[\ \	]-Wnested-externs[\ \	]*) ;;
    64   *) CFLAGS="$CFLAGS -Wnested-externs" ;;
    65   esac
    66 
    67   case " $CFLAGS " in
    68   *[\ \	]-Wcast-align[\ \	]*) ;;
    69   *) CFLAGS="$CFLAGS -Wcast-align" ;;
    70   esac
    71 
    72   case " $CFLAGS " in
    73   *[\ \	]-Wformat[\ \	]*) ;;
    74   *) CFLAGS="$CFLAGS -Wformat" ;;
    75   esac
    76 
    77   case " $CFLAGS " in
    78   *[\ \	]-Wformat-security[\ \	]*) ;;
    79   *) CFLAGS="$CFLAGS -Wformat-security" ;;
    80   esac
    81 
    82   if test "x$enable_ansi" = "xyes"; then
    83     case " $CFLAGS " in
    84     *[\ \	]-ansi[\ \	]*) ;;
    85     *) CFLAGS="$CFLAGS -ansi" ;;
    86     esac
    87 
    88     case " $CFLAGS " in
    89     *[\ \	]-D_POSIX_C_SOURCE*) ;;
    90     *) CFLAGS="$CFLAGS -D_POSIX_C_SOURCE=199309L" ;;
    91     esac
    92 
    93     case " $CFLAGS " in
    94     *[\ \	]-D_BSD_SOURCE[\ \	]*) ;;
    95     *) CFLAGS="$CFLAGS -D_BSD_SOURCE" ;;
    96     esac
    97 
    98     case " $CFLAGS " in
    99     *[\ \	]-pedantic[\ \	]*) ;;
   100     *) CFLAGS="$CFLAGS -pedantic" ;;
   101     esac
   102   fi
   103   changequote([,])dnl
   104 fi
   105 
   106 PKG_CHECK_MODULES(CURL, [libcurl])
   107 AC_SUBST(CURL_CFLAGS)
   108 AC_SUBST(CURL_LIBS)
   109 
   110 ZLIB_LIBS=""
   111 AC_ARG_WITH(zlib, [  --with-zlib=<dir>       Use zlib from here],
   112                       [
   113                       zlib=$withval
   114                       CPPFLAGS="$CPPFLAGS -I$withval/include"
   115                       LDFLAGS="$LDFLAGS -L$withval/lib"
   116                       ]
   117                       )
   118 AC_CHECK_HEADERS(zlib.h, [AC_DEFINE(HAVE_ZLIB_H)],
   119                  [AC_MSG_ERROR([Can't find zlib.h. Please install zlib.])])
   120 AC_CHECK_LIB(z, inflate, [ZLIB_LIBS="-lz"],
   121 	     [AC_MSG_ERROR([Can't find zlib library. Please install zlib.])])
   122 AC_SUBST(ZLIB_LIBS)
   123 
   124 EXPAT_LIB=""
   125 AC_ARG_WITH(expat, [  --with-expat=<dir>      Use expat from here],
   126                       [
   127                       expat=$withval
   128                       CPPFLAGS="$CPPFLAGS -I$withval/include"
   129                       LDFLAGS="$LDFLAGS -L$withval/lib"
   130                       ]
   131                       )
   132 AC_CHECK_HEADERS(expat.h, [AC_DEFINE(HAVE_EXPAT_H)], 
   133 		 [AC_MSG_ERROR([Can't find expat.h. Please install expat.])])
   134 AC_CHECK_LIB(expat, XML_ParserCreate, [EXPAT_LIBS="-lexpat"],
   135 	     [AC_MSG_ERROR([Can't find expat library. Please install expat.])])
   136 AC_SUBST(EXPAT_LIBS)
   137 
   138 RPM_LIB=""
   139 AC_ARG_WITH(rpm, [  --with-rpm=<dir>      Use rpm from here],
   140                       [
   141                       rpm=$withval
   142                       CPPFLAGS="$CPPFLAGS -I$withval/include"
   143                       LDFLAGS="$LDFLAGS -L$withval/lib"
   144                       ]
   145                       )
   146 AC_CHECK_HEADERS(rpm/rpmlib.h, [], 
   147 		 [AC_MSG_ERROR([Can't find rpm/rpmlib.h. Please install rpm-devel.])])
   148 AC_CHECK_LIB(rpm,rpmdbOpen,[RPM_LIBS="-lrpm"],
   149 	     [AC_MSG_ERROR([Can't find rpm library. Please install rpm-devel.])])
   150 AC_SUBST(RPM_LIBS)
   151 
   152 if test "x$GCC" = "xyes"; then
   153   LDFLAGS="-Wl,--as-needed $LDFLAGS"
   154 fi
   155 
   156 # *****************************
   157 # Make available to Makefile.am
   158 # *****************************
   159 AC_SUBST(SYSCONFDIR, $sysconfdir)
   160 
   161 # ********************
   162 # Internationalisation
   163 # ********************
   164 
   165 IT_PROG_INTLTOOL([0.36.0])
   166 GETTEXT_PACKAGE=razor
   167 AC_SUBST([GETTEXT_PACKAGE])
   168 AM_GLIB_GNU_GETTEXT
   169 AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[gettext domain])
   170 
   171 AC_OUTPUT([
   172 Makefile
   173 data/razor.pc
   174 data/Makefile
   175 librazor/Makefile
   176 src/Makefile
   177 docs/Makefile
   178 po/Makefile.in
   179 ])
   180 
   181 dnl ==========================================================================
   182 echo "
   183                   razor $VERSION
   184                 =================
   185 
   186         prefix:                     ${prefix}
   187         libdir:                     ${libdir}
   188         libexecdir:                 ${libexecdir}
   189         bindir:                     ${bindir}
   190         sbindir:                    ${sbindir}
   191         datadir:                    ${datadir}
   192         sysconfdir:                 ${sysconfdir}
   193         localstatedir:              ${localstatedir}
   194         docdir:                     ${docdir}
   195 
   196         compiler:                   ${CC}
   197         cflags:                     ${CFLAGS}
   198         Maintainer mode:            ${USE_MAINTAINER_MODE}
   199         Building verbose mode:      ${enable_verbose_mode}
   200 "
   201