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