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