configure.ac
author J. Ali Harlow <ali@juiblex.co.uk>
Wed Jan 07 17:17:10 2009 +0000 (2009-01-07)
changeset 323 3b24a0bd41ee
parent 322 66c281524c98
child 327 c85643dd7164
permissions -rw-r--r--
Add support for platforms without fnmatch.

This uses gnulib so you will need to have a copy in order
to run autogen.sh (but not to build from a tarball). Either
arrange for gnulib-tool to be in your path or set the
environment variable GNULIB_TOOL to point to its location.
rhughes@241
     1
dnl Process this file with autoconf to produce a configure script.
rhughes@241
     2
rhughes@241
     3
AC_PREREQ(2.59c)
richard@272
     4
AC_INIT(razor, 0.1, krh@redhat.com)
rhughes@241
     5
AM_INIT_AUTOMAKE(razor, 0.1)
rhughes@241
     6
AM_CONFIG_HEADER(config.h)
rhughes@241
     7
AM_MAINTAINER_MODE
rhughes@241
     8
rhughes@241
     9
# libtool versioning - this applies to all libraries in this package
rhughes@241
    10
#
rhughes@241
    11
# See http://sources.redhat.com/autobook/autobook/autobook_91.html#SEC91 for details
rhughes@241
    12
#
rhughes@241
    13
LT_CURRENT=1
rhughes@241
    14
LT_REVISION=0
rhughes@241
    15
LT_AGE=0
rhughes@241
    16
AC_SUBST(LT_CURRENT)
rhughes@241
    17
AC_SUBST(LT_REVISION)
rhughes@241
    18
AC_SUBST(LT_AGE)
rhughes@241
    19
rhughes@241
    20
AC_ISC_POSIX
rhughes@241
    21
AC_PROG_CC
ali@323
    22
gl_EARLY
rhughes@241
    23
AM_PROG_CC_STDC
rhughes@241
    24
AC_HEADER_STDC
ali@322
    25
AC_CHECK_HEADERS([sys/mman.h])
ali@323
    26
gl_INIT
rhughes@241
    27
AM_PROG_LIBTOOL
rhughes@241
    28
AC_PROG_MAKE_SET
rhughes@241
    29
AC_PROG_LN_S
rhughes@241
    30
AC_SYS_LARGEFILE
rhughes@241
    31
AM_PROG_CC_C_O
rhughes@241
    32
rhughes@241
    33
# Taken from dbus
rhughes@241
    34
AC_ARG_ENABLE(ansi,             [  --enable-ansi           enable -ansi -pedantic gcc flags],enable_ansi=$enableval,enable_ansi=no)
rhughes@241
    35
AC_ARG_ENABLE(verbose-mode,     [  --enable-verbose-mode   support verbose debug mode],enable_verbose_mode=$enableval,enable_verbose_mode=$USE_MAINTAINER_MODE)
rhughes@241
    36
rhughes@241
    37
if test "${enable_verbose_mode}" != no; then
rhughes@241
    38
    # To get -rdynamic you pass -export-dynamic to libtool.
rhughes@241
    39
    AC_DEFINE(BUILT_R_DYNAMIC,1,[whether -export-dynamic was passed to libtool])
rhughes@241
    40
    R_DYNAMIC_LDFLAG=-export-dynamic
rhughes@241
    41
else
rhughes@241
    42
    R_DYNAMIC_LDFLAG=
rhughes@241
    43
fi
rhughes@241
    44
AC_SUBST(R_DYNAMIC_LDFLAG)
rhughes@241
    45
rhughes@241
    46
#### gcc warning flags
rhughes@241
    47
rhughes@241
    48
if test "x$GCC" = "xyes"; then
rhughes@241
    49
  changequote(,)dnl
rhughes@241
    50
  case " $CFLAGS " in
rhughes@241
    51
  *[\ \	]-Wall[\ \	]*) ;;
rhughes@241
    52
  *) CFLAGS="$CFLAGS -Wall" ;;
rhughes@241
    53
  esac
rhughes@241
    54
rhughes@241
    55
  case " $CFLAGS " in
rhughes@241
    56
  *[\ \	]-Wchar-subscripts[\ \	]*) ;;
rhughes@241
    57
  *) CFLAGS="$CFLAGS -Wchar-subscripts" ;;
rhughes@241
    58
  esac
rhughes@241
    59
rhughes@241
    60
  case " $CFLAGS " in
rhughes@241
    61
  *[\ \	]-Wmissing-declarations[\ \	]*) ;;
rhughes@241
    62
  *) CFLAGS="$CFLAGS -Wmissing-declarations" ;;
rhughes@241
    63
  esac
rhughes@241
    64
rhughes@241
    65
  case " $CFLAGS " in
rhughes@241
    66
  *[\ \	]-Wnested-externs[\ \	]*) ;;
rhughes@241
    67
  *) CFLAGS="$CFLAGS -Wnested-externs" ;;
rhughes@241
    68
  esac
rhughes@241
    69
rhughes@241
    70
  case " $CFLAGS " in
rhughes@241
    71
  *[\ \	]-Wcast-align[\ \	]*) ;;
rhughes@241
    72
  *) CFLAGS="$CFLAGS -Wcast-align" ;;
rhughes@241
    73
  esac
rhughes@241
    74
rhughes@241
    75
  case " $CFLAGS " in
rhughes@241
    76
  *[\ \	]-Wformat[\ \	]*) ;;
rhughes@241
    77
  *) CFLAGS="$CFLAGS -Wformat" ;;
rhughes@241
    78
  esac
rhughes@241
    79
rhughes@241
    80
  case " $CFLAGS " in
rhughes@241
    81
  *[\ \	]-Wformat-security[\ \	]*) ;;
rhughes@241
    82
  *) CFLAGS="$CFLAGS -Wformat-security" ;;
rhughes@241
    83
  esac
rhughes@241
    84
rhughes@241
    85
  if test "x$enable_ansi" = "xyes"; then
rhughes@241
    86
    case " $CFLAGS " in
rhughes@241
    87
    *[\ \	]-ansi[\ \	]*) ;;
rhughes@241
    88
    *) CFLAGS="$CFLAGS -ansi" ;;
rhughes@241
    89
    esac
rhughes@241
    90
rhughes@241
    91
    case " $CFLAGS " in
rhughes@241
    92
    *[\ \	]-D_POSIX_C_SOURCE*) ;;
rhughes@241
    93
    *) CFLAGS="$CFLAGS -D_POSIX_C_SOURCE=199309L" ;;
rhughes@241
    94
    esac
rhughes@241
    95
rhughes@241
    96
    case " $CFLAGS " in
rhughes@241
    97
    *[\ \	]-D_BSD_SOURCE[\ \	]*) ;;
rhughes@241
    98
    *) CFLAGS="$CFLAGS -D_BSD_SOURCE" ;;
rhughes@241
    99
    esac
rhughes@241
   100
rhughes@241
   101
    case " $CFLAGS " in
rhughes@241
   102
    *[\ \	]-pedantic[\ \	]*) ;;
rhughes@241
   103
    *) CFLAGS="$CFLAGS -pedantic" ;;
rhughes@241
   104
    esac
rhughes@241
   105
  fi
rhughes@241
   106
  changequote([,])dnl
rhughes@241
   107
fi
rhughes@241
   108
krh@269
   109
krh@269
   110
# gcc default visibility stuff
krh@269
   111
krh@269
   112
have_gcc4=no
krh@269
   113
AC_MSG_CHECKING(for -fvisibility)
krh@269
   114
AC_COMPILE_IFELSE([
krh@269
   115
#if defined(__GNUC__) && (__GNUC__ >= 4)
krh@269
   116
#else
krh@269
   117
#error Need GCC 4.0 for visibility
krh@269
   118
#endif
krh@269
   119
int main () { return 0; } 
krh@269
   120
], have_gcc4=yes)
krh@269
   121
krh@269
   122
if test "x$have_gcc4" = "xyes"; then
krh@269
   123
   CFLAGS="$CFLAGS -fvisibility=hidden"
krh@269
   124
fi
krh@269
   125
AC_MSG_RESULT($have_gcc4)
krh@269
   126
krh@269
   127
ali@321
   128
AC_ARG_WITH([curl],
ali@321
   129
            [AS_HELP_STRING([--without-curl], [disable support for curl])],
ali@321
   130
            [],
ali@321
   131
            [with_curl=yes])
ali@321
   132
          
ali@321
   133
CURL_CFLAGS=
ali@321
   134
CURL_LIBS=
ali@321
   135
AS_IF([test "x$with_curl" != xno],
ali@321
   136
  [PKG_CHECK_MODULES(CURL, [libcurl])
ali@321
   137
   AC_DEFINE([HAVE_CURL], [1], [Define if you have curl])])
rhughes@241
   138
AC_SUBST(CURL_CFLAGS)
rhughes@241
   139
AC_SUBST(CURL_LIBS)
rhughes@241
   140
rhughes@241
   141
ZLIB_LIBS=""
rhughes@241
   142
AC_ARG_WITH(zlib, [  --with-zlib=<dir>       Use zlib from here],
rhughes@241
   143
                      [
rhughes@241
   144
                      zlib=$withval
rhughes@241
   145
                      CPPFLAGS="$CPPFLAGS -I$withval/include"
rhughes@241
   146
                      LDFLAGS="$LDFLAGS -L$withval/lib"
rhughes@241
   147
                      ]
rhughes@241
   148
                      )
rhughes@241
   149
AC_CHECK_HEADERS(zlib.h, [AC_DEFINE(HAVE_ZLIB_H)],
rhughes@241
   150
                 [AC_MSG_ERROR([Can't find zlib.h. Please install zlib.])])
rhughes@241
   151
AC_CHECK_LIB(z, inflate, [ZLIB_LIBS="-lz"],
rhughes@241
   152
	     [AC_MSG_ERROR([Can't find zlib library. Please install zlib.])])
rhughes@241
   153
AC_SUBST(ZLIB_LIBS)
rhughes@241
   154
rhughes@241
   155
EXPAT_LIB=""
rhughes@241
   156
AC_ARG_WITH(expat, [  --with-expat=<dir>      Use expat from here],
rhughes@241
   157
                      [
rhughes@241
   158
                      expat=$withval
rhughes@241
   159
                      CPPFLAGS="$CPPFLAGS -I$withval/include"
rhughes@241
   160
                      LDFLAGS="$LDFLAGS -L$withval/lib"
rhughes@241
   161
                      ]
rhughes@241
   162
                      )
rhughes@241
   163
AC_CHECK_HEADERS(expat.h, [AC_DEFINE(HAVE_EXPAT_H)], 
rhughes@241
   164
		 [AC_MSG_ERROR([Can't find expat.h. Please install expat.])])
rhughes@241
   165
AC_CHECK_LIB(expat, XML_ParserCreate, [EXPAT_LIBS="-lexpat"],
rhughes@241
   166
	     [AC_MSG_ERROR([Can't find expat library. Please install expat.])])
rhughes@241
   167
AC_SUBST(EXPAT_LIBS)
rhughes@241
   168
ali@320
   169
RPM_LIBS=""
ali@320
   170
AC_ARG_WITH(rpm, [  --with-rpm=<dir>      Use rpm from here])
ali@320
   171
ali@320
   172
AS_IF([test "$with_rpm" != no],
ali@320
   173
      [if test "$with_rpm" != yes; then
ali@320
   174
	    CPPFLAGS="$CPPFLAGS -I$with_rpm/include"
ali@320
   175
            LDFLAGS="$LDFLAGS -L$with_rpm/lib"
ali@320
   176
       fi
ali@320
   177
       AC_CHECK_HEADERS(rpm/rpmlib.h, [], 
ali@320
   178
		 [AC_MSG_ERROR([Can't find rpm/rpmlib.h. Please install rpm-devel or use --without-rpm.])])
ali@320
   179
       AC_CHECK_LIB(rpm,rpmdbOpen,[RPM_LIBS="-lrpm"],
ali@320
   180
	     [AC_MSG_ERROR([Can't find rpm library. Please install rpm-devel or use --without-rpm.])])
ali@320
   181
       AC_DEFINE([HAVE_RPMLIB], [1], [Define if you have librpm])])
rhughes@241
   182
AC_SUBST(RPM_LIBS)
ali@320
   183
AM_CONDITIONAL([HAVE_RPMLIB], [test -n "$RPM_LIBS"])
rhughes@241
   184
rhughes@241
   185
if test "x$GCC" = "xyes"; then
rhughes@241
   186
  LDFLAGS="-Wl,--as-needed $LDFLAGS"
rhughes@241
   187
fi
rhughes@241
   188
rhughes@241
   189
# *****************************
rhughes@241
   190
# Make available to Makefile.am
rhughes@241
   191
# *****************************
rhughes@241
   192
AC_SUBST(SYSCONFDIR, $sysconfdir)
rhughes@241
   193
rhughes@241
   194
# ********************
rhughes@241
   195
# Internationalisation
rhughes@241
   196
# ********************
rhughes@241
   197
ali@319
   198
IT_PROG_INTLTOOL([0.35.0])
rhughes@241
   199
GETTEXT_PACKAGE=razor
rhughes@241
   200
AC_SUBST([GETTEXT_PACKAGE])
rhughes@241
   201
AM_GLIB_GNU_GETTEXT
rhughes@241
   202
AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[gettext domain])
rhughes@241
   203
krh@262
   204
GTK_DOC_CHECK([1.9])
krh@262
   205
rhughes@241
   206
AC_OUTPUT([
rhughes@241
   207
Makefile
rhughes@241
   208
data/razor.pc
rhughes@241
   209
data/Makefile
rhughes@241
   210
librazor/Makefile
rhughes@241
   211
src/Makefile
rhughes@241
   212
docs/Makefile
krh@262
   213
docs/version.xml
rhughes@241
   214
po/Makefile.in
ali@323
   215
gl/Makefile
rhughes@241
   216
])
rhughes@241
   217
rhughes@241
   218
dnl ==========================================================================
rhughes@241
   219
echo "
rhughes@241
   220
                  razor $VERSION
rhughes@241
   221
                =================
rhughes@241
   222
rhughes@241
   223
        prefix:                     ${prefix}
rhughes@241
   224
        libdir:                     ${libdir}
rhughes@241
   225
        libexecdir:                 ${libexecdir}
rhughes@241
   226
        bindir:                     ${bindir}
rhughes@241
   227
        sbindir:                    ${sbindir}
rhughes@241
   228
        datadir:                    ${datadir}
rhughes@241
   229
        sysconfdir:                 ${sysconfdir}
rhughes@241
   230
        localstatedir:              ${localstatedir}
rhughes@241
   231
        docdir:                     ${docdir}
rhughes@241
   232
rhughes@241
   233
        compiler:                   ${CC}
rhughes@241
   234
        cflags:                     ${CFLAGS}
rhughes@241
   235
        Maintainer mode:            ${USE_MAINTAINER_MODE}
rhughes@241
   236
        Building verbose mode:      ${enable_verbose_mode}
krh@294
   237
        Building gtk-doc:           ${enable_gtk_doc}
rhughes@241
   238
"