configure.ac
author James Bowes <jbowes@redhat.com>
Mon Jun 23 19:43:52 2008 -0400 (2008-06-23)
changeset 273 3e37dc49d6b7
parent 269 03fc85294bc9
child 294 d7ecddf38c3d
permissions -rw-r--r--
Save all 3 repo files on razor_root_create
     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 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 
   107 # gcc default visibility stuff
   108 
   109 have_gcc4=no
   110 AC_MSG_CHECKING(for -fvisibility)
   111 AC_COMPILE_IFELSE([
   112 #if defined(__GNUC__) && (__GNUC__ >= 4)
   113 #else
   114 #error Need GCC 4.0 for visibility
   115 #endif
   116 int main () { return 0; } 
   117 ], have_gcc4=yes)
   118 
   119 if test "x$have_gcc4" = "xyes"; then
   120    CFLAGS="$CFLAGS -fvisibility=hidden"
   121 fi
   122 AC_MSG_RESULT($have_gcc4)
   123 
   124 
   125 PKG_CHECK_MODULES(CURL, [libcurl])
   126 AC_SUBST(CURL_CFLAGS)
   127 AC_SUBST(CURL_LIBS)
   128 
   129 ZLIB_LIBS=""
   130 AC_ARG_WITH(zlib, [  --with-zlib=<dir>       Use zlib from here],
   131                       [
   132                       zlib=$withval
   133                       CPPFLAGS="$CPPFLAGS -I$withval/include"
   134                       LDFLAGS="$LDFLAGS -L$withval/lib"
   135                       ]
   136                       )
   137 AC_CHECK_HEADERS(zlib.h, [AC_DEFINE(HAVE_ZLIB_H)],
   138                  [AC_MSG_ERROR([Can't find zlib.h. Please install zlib.])])
   139 AC_CHECK_LIB(z, inflate, [ZLIB_LIBS="-lz"],
   140 	     [AC_MSG_ERROR([Can't find zlib library. Please install zlib.])])
   141 AC_SUBST(ZLIB_LIBS)
   142 
   143 EXPAT_LIB=""
   144 AC_ARG_WITH(expat, [  --with-expat=<dir>      Use expat from here],
   145                       [
   146                       expat=$withval
   147                       CPPFLAGS="$CPPFLAGS -I$withval/include"
   148                       LDFLAGS="$LDFLAGS -L$withval/lib"
   149                       ]
   150                       )
   151 AC_CHECK_HEADERS(expat.h, [AC_DEFINE(HAVE_EXPAT_H)], 
   152 		 [AC_MSG_ERROR([Can't find expat.h. Please install expat.])])
   153 AC_CHECK_LIB(expat, XML_ParserCreate, [EXPAT_LIBS="-lexpat"],
   154 	     [AC_MSG_ERROR([Can't find expat library. Please install expat.])])
   155 AC_SUBST(EXPAT_LIBS)
   156 
   157 RPM_LIB=""
   158 AC_ARG_WITH(rpm, [  --with-rpm=<dir>      Use rpm from here],
   159                       [
   160                       rpm=$withval
   161                       CPPFLAGS="$CPPFLAGS -I$withval/include"
   162                       LDFLAGS="$LDFLAGS -L$withval/lib"
   163                       ]
   164                       )
   165 AC_CHECK_HEADERS(rpm/rpmlib.h, [], 
   166 		 [AC_MSG_ERROR([Can't find rpm/rpmlib.h. Please install rpm-devel.])])
   167 AC_CHECK_LIB(rpm,rpmdbOpen,[RPM_LIBS="-lrpm"],
   168 	     [AC_MSG_ERROR([Can't find rpm library. Please install rpm-devel.])])
   169 AC_SUBST(RPM_LIBS)
   170 
   171 if test "x$GCC" = "xyes"; then
   172   LDFLAGS="-Wl,--as-needed $LDFLAGS"
   173 fi
   174 
   175 # *****************************
   176 # Make available to Makefile.am
   177 # *****************************
   178 AC_SUBST(SYSCONFDIR, $sysconfdir)
   179 
   180 # ********************
   181 # Internationalisation
   182 # ********************
   183 
   184 IT_PROG_INTLTOOL([0.36.0])
   185 GETTEXT_PACKAGE=razor
   186 AC_SUBST([GETTEXT_PACKAGE])
   187 AM_GLIB_GNU_GETTEXT
   188 AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[gettext domain])
   189 
   190 GTK_DOC_CHECK([1.9])
   191 
   192 AC_OUTPUT([
   193 Makefile
   194 data/razor.pc
   195 data/Makefile
   196 librazor/Makefile
   197 src/Makefile
   198 docs/Makefile
   199 docs/version.xml
   200 po/Makefile.in
   201 ])
   202 
   203 dnl ==========================================================================
   204 echo "
   205                   razor $VERSION
   206                 =================
   207 
   208         prefix:                     ${prefix}
   209         libdir:                     ${libdir}
   210         libexecdir:                 ${libexecdir}
   211         bindir:                     ${bindir}
   212         sbindir:                    ${sbindir}
   213         datadir:                    ${datadir}
   214         sysconfdir:                 ${sysconfdir}
   215         localstatedir:              ${localstatedir}
   216         docdir:                     ${docdir}
   217 
   218         compiler:                   ${CC}
   219         cflags:                     ${CFLAGS}
   220         Maintainer mode:            ${USE_MAINTAINER_MODE}
   221         Building verbose mode:      ${enable_verbose_mode}
   222 "
   223