configure.ac
author J. Ali Harlow <ali@juiblex.co.uk>
Wed Apr 28 11:59:02 2010 +0100 (2010-04-28)
changeset 395 ed134fdfe95f
parent 385 3cde352d3270
child 397 4efbc922dc87
permissions -rw-r--r--
Treat missing detail strings as empty
rhughes@241
     1
dnl Process this file with autoconf to produce a configure script.
rhughes@241
     2
rhughes@241
     3
AC_PREREQ(2.59c)
ali@392
     4
AC_INIT([razor], [0.4], [ali@juiblex.co.uk])
ali@380
     5
AM_INIT_AUTOMAKE([])
ali@380
     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
ali@392
    14
LT_REVISION=2
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])
ali@354
    29
AC_LIBTOOL_WIN32_DLL
rhughes@241
    30
AM_PROG_LIBTOOL
rhughes@241
    31
AC_PROG_MAKE_SET
rhughes@241
    32
AC_PROG_LN_S
rhughes@241
    33
AC_SYS_LARGEFILE
rhughes@241
    34
AM_PROG_CC_C_O
rhughes@241
    35
ali@328
    36
AC_MSG_CHECKING([for Microsoft Windows native API])
ali@328
    37
case $host_os in
ali@328
    38
    *mingw*)	AC_DEFINE([MSWIN_API], 1,
ali@328
    39
		  [Define to 1 to use Microsoft Windows native API.])
ali@340
    40
		EXTRA_LIBS='-lshell32 -lws2_32'
ali@328
    41
		mswin_api=yes;;
ali@328
    42
    *)		mswin_api=no;;
ali@328
    43
esac
ali@328
    44
AC_MSG_RESULT([$mswin_api])
ali@328
    45
AM_CONDITIONAL(MSWIN_API, test "$mswin_api" = "yes")
ali@335
    46
AC_SUBST(EXTRA_LIBS)
ali@328
    47
rhughes@241
    48
# Taken from dbus
rhughes@241
    49
AC_ARG_ENABLE(ansi,             [  --enable-ansi           enable -ansi -pedantic gcc flags],enable_ansi=$enableval,enable_ansi=no)
rhughes@241
    50
AC_ARG_ENABLE(verbose-mode,     [  --enable-verbose-mode   support verbose debug mode],enable_verbose_mode=$enableval,enable_verbose_mode=$USE_MAINTAINER_MODE)
rhughes@241
    51
rhughes@241
    52
if test "${enable_verbose_mode}" != no; then
rhughes@241
    53
    # To get -rdynamic you pass -export-dynamic to libtool.
rhughes@241
    54
    AC_DEFINE(BUILT_R_DYNAMIC,1,[whether -export-dynamic was passed to libtool])
rhughes@241
    55
    R_DYNAMIC_LDFLAG=-export-dynamic
rhughes@241
    56
else
rhughes@241
    57
    R_DYNAMIC_LDFLAG=
rhughes@241
    58
fi
rhughes@241
    59
AC_SUBST(R_DYNAMIC_LDFLAG)
rhughes@241
    60
rhughes@241
    61
#### gcc warning flags
rhughes@241
    62
rhughes@241
    63
if test "x$GCC" = "xyes"; then
rhughes@241
    64
  changequote(,)dnl
rhughes@241
    65
  case " $CFLAGS " in
rhughes@241
    66
  *[\ \	]-Wall[\ \	]*) ;;
rhughes@241
    67
  *) CFLAGS="$CFLAGS -Wall" ;;
rhughes@241
    68
  esac
rhughes@241
    69
rhughes@241
    70
  case " $CFLAGS " in
rhughes@241
    71
  *[\ \	]-Wchar-subscripts[\ \	]*) ;;
rhughes@241
    72
  *) CFLAGS="$CFLAGS -Wchar-subscripts" ;;
rhughes@241
    73
  esac
rhughes@241
    74
rhughes@241
    75
  case " $CFLAGS " in
rhughes@241
    76
  *[\ \	]-Wmissing-declarations[\ \	]*) ;;
rhughes@241
    77
  *) CFLAGS="$CFLAGS -Wmissing-declarations" ;;
rhughes@241
    78
  esac
rhughes@241
    79
rhughes@241
    80
  case " $CFLAGS " in
rhughes@241
    81
  *[\ \	]-Wnested-externs[\ \	]*) ;;
rhughes@241
    82
  *) CFLAGS="$CFLAGS -Wnested-externs" ;;
rhughes@241
    83
  esac
rhughes@241
    84
rhughes@241
    85
  case " $CFLAGS " in
rhughes@241
    86
  *[\ \	]-Wcast-align[\ \	]*) ;;
rhughes@241
    87
  *) CFLAGS="$CFLAGS -Wcast-align" ;;
rhughes@241
    88
  esac
rhughes@241
    89
rhughes@241
    90
  case " $CFLAGS " in
rhughes@241
    91
  *[\ \	]-Wformat[\ \	]*) ;;
rhughes@241
    92
  *) CFLAGS="$CFLAGS -Wformat" ;;
rhughes@241
    93
  esac
rhughes@241
    94
rhughes@241
    95
  case " $CFLAGS " in
rhughes@241
    96
  *[\ \	]-Wformat-security[\ \	]*) ;;
rhughes@241
    97
  *) CFLAGS="$CFLAGS -Wformat-security" ;;
rhughes@241
    98
  esac
rhughes@241
    99
rhughes@241
   100
  if test "x$enable_ansi" = "xyes"; then
rhughes@241
   101
    case " $CFLAGS " in
rhughes@241
   102
    *[\ \	]-ansi[\ \	]*) ;;
rhughes@241
   103
    *) CFLAGS="$CFLAGS -ansi" ;;
rhughes@241
   104
    esac
rhughes@241
   105
rhughes@241
   106
    case " $CFLAGS " in
rhughes@241
   107
    *[\ \	]-D_POSIX_C_SOURCE*) ;;
rhughes@241
   108
    *) CFLAGS="$CFLAGS -D_POSIX_C_SOURCE=199309L" ;;
rhughes@241
   109
    esac
rhughes@241
   110
rhughes@241
   111
    case " $CFLAGS " in
rhughes@241
   112
    *[\ \	]-D_BSD_SOURCE[\ \	]*) ;;
rhughes@241
   113
    *) CFLAGS="$CFLAGS -D_BSD_SOURCE" ;;
rhughes@241
   114
    esac
rhughes@241
   115
rhughes@241
   116
    case " $CFLAGS " in
rhughes@241
   117
    *[\ \	]-pedantic[\ \	]*) ;;
rhughes@241
   118
    *) CFLAGS="$CFLAGS -pedantic" ;;
rhughes@241
   119
    esac
rhughes@241
   120
  fi
rhughes@241
   121
  changequote([,])dnl
rhughes@241
   122
fi
rhughes@241
   123
krh@269
   124
krh@269
   125
# gcc default visibility stuff
krh@269
   126
krh@269
   127
have_gcc4=no
krh@269
   128
AC_MSG_CHECKING(for -fvisibility)
krh@269
   129
AC_COMPILE_IFELSE([
krh@269
   130
#if defined(__GNUC__) && (__GNUC__ >= 4)
krh@269
   131
#else
krh@269
   132
#error Need GCC 4.0 for visibility
krh@269
   133
#endif
krh@269
   134
int main () { return 0; } 
krh@269
   135
], have_gcc4=yes)
krh@269
   136
krh@269
   137
if test "x$have_gcc4" = "xyes"; then
krh@269
   138
   CFLAGS="$CFLAGS -fvisibility=hidden"
krh@269
   139
fi
krh@269
   140
AC_MSG_RESULT($have_gcc4)
krh@269
   141
ali@344
   142
REQUIREMENTS=""
ali@321
   143
AC_ARG_WITH([curl],
ali@321
   144
            [AS_HELP_STRING([--without-curl], [disable support for curl])],
ali@321
   145
            [],
ali@321
   146
            [with_curl=yes])
ali@321
   147
          
ali@321
   148
CURL_CFLAGS=
ali@321
   149
CURL_LIBS=
ali@321
   150
AS_IF([test "x$with_curl" != xno],
ali@321
   151
  [PKG_CHECK_MODULES(CURL, [libcurl])
ali@321
   152
   AC_DEFINE([HAVE_CURL], [1], [Define if you have curl])])
rhughes@241
   153
AC_SUBST(CURL_CFLAGS)
rhughes@241
   154
AC_SUBST(CURL_LIBS)
rhughes@241
   155
rhughes@241
   156
ZLIB_LIBS=""
rhughes@241
   157
AC_ARG_WITH(zlib, [  --with-zlib=<dir>       Use zlib from here],
rhughes@241
   158
                      [
rhughes@241
   159
                      zlib=$withval
rhughes@241
   160
                      CPPFLAGS="$CPPFLAGS -I$withval/include"
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.])])
ali@344
   165
save_ldflags="$LDFLAGS"
ali@344
   166
LDFLAGS="$LDFLAGS -L$zlib/lib"
ali@344
   167
AC_CHECK_LIB(z, inflate, [ZLIB_LIBS="-L$zlib/lib -lz"],
rhughes@241
   168
	     [AC_MSG_ERROR([Can't find zlib library. Please install zlib.])])
ali@344
   169
LDFLAGS="$save_ldflags"
rhughes@241
   170
AC_SUBST(ZLIB_LIBS)
rhughes@241
   171
rhughes@241
   172
EXPAT_LIB=""
rhughes@241
   173
AC_ARG_WITH(expat, [  --with-expat=<dir>      Use expat from here],
rhughes@241
   174
                      [
rhughes@241
   175
                      expat=$withval
rhughes@241
   176
                      CPPFLAGS="$CPPFLAGS -I$withval/include"
rhughes@241
   177
                      ]
rhughes@241
   178
                      )
rhughes@241
   179
AC_CHECK_HEADERS(expat.h, [AC_DEFINE(HAVE_EXPAT_H)], 
rhughes@241
   180
		 [AC_MSG_ERROR([Can't find expat.h. Please install expat.])])
ali@344
   181
save_ldflags="$LDFLAGS"
ali@344
   182
LDFLAGS="$LDFLAGS -L$expat/lib"
ali@344
   183
AC_CHECK_LIB(expat, XML_ParserCreate, [EXPAT_LIBS="-L$expat/lib -lexpat"],
rhughes@241
   184
	     [AC_MSG_ERROR([Can't find expat library. Please install expat.])])
ali@344
   185
LDFLAGS="$save_ldflags"
rhughes@241
   186
AC_SUBST(EXPAT_LIBS)
rhughes@241
   187
ali@320
   188
RPM_LIBS=""
ali@320
   189
AC_ARG_WITH(rpm, [  --with-rpm=<dir>      Use rpm from here])
ali@320
   190
ali@320
   191
AS_IF([test "$with_rpm" != no],
ali@320
   192
      [if test "$with_rpm" != yes; then
ali@320
   193
	    CPPFLAGS="$CPPFLAGS -I$with_rpm/include"
ali@320
   194
       fi
ali@320
   195
       AC_CHECK_HEADERS(rpm/rpmlib.h, [], 
ali@320
   196
		 [AC_MSG_ERROR([Can't find rpm/rpmlib.h. Please install rpm-devel or use --without-rpm.])])
ali@344
   197
       save_ldflags="$LDFLAGS"
ali@344
   198
       LDFLAGS="$LDFLAGS -L$with_rpm/lib"
ali@344
   199
       AC_CHECK_LIB(rpm,rpmdbOpen,[RPM_LIBS="-L$with_rpm/lib -lrpm"],
ali@320
   200
	     [AC_MSG_ERROR([Can't find rpm library. Please install rpm-devel or use --without-rpm.])])
ali@344
   201
       LDFLAGS="$save_ldflags"
ali@320
   202
       AC_DEFINE([HAVE_RPMLIB], [1], [Define if you have librpm])])
rhughes@241
   203
AC_SUBST(RPM_LIBS)
ali@320
   204
AM_CONDITIONAL([HAVE_RPMLIB], [test -n "$RPM_LIBS"])
ali@352
   205
ali@352
   206
AC_ARG_WITH([lua],
ali@352
   207
            [AS_HELP_STRING([--without-lua], [disable support for lua])],
ali@352
   208
            [],
ali@352
   209
            [with_lua=yes])
ali@352
   210
          
ali@352
   211
LUA_CFLAGS=
ali@352
   212
LUA_LIBS=
ali@352
   213
AS_IF([test "x$with_lua" != xno],
ali@352
   214
  [PKG_CHECK_MODULES(LUA, [lua])
ali@352
   215
   REQUIREMENTS="$REQUIREMENTS lua"
ali@352
   216
   AC_DEFINE([HAVE_LUA], [1], [Define if you have lua])
ali@352
   217
   AC_PATH_PROG(LUA, [lua], [no])
ali@352
   218
   AS_IF([test "x$LUA" = xno],
ali@352
   219
     [AC_MSG_ERROR([Can't find lua program. Please install lua-devel or use --without-lua.])])
ali@352
   220
   AC_DEFINE_UNQUOTED([LUA_BINARY], ["$LUA"],
ali@352
   221
     [Define to the location of the lua binary])])
ali@352
   222
AC_SUBST(LUA_CFLAGS)
ali@352
   223
AC_SUBST(LUA_LIBS)
ali@352
   224
AM_CONDITIONAL([HAVE_LUA], [test "x$with_lua" != xno])
ali@352
   225
ali@344
   226
AC_SUBST(REQUIREMENTS)
rhughes@241
   227
rhughes@241
   228
if test "x$GCC" = "xyes"; then
rhughes@241
   229
  LDFLAGS="-Wl,--as-needed $LDFLAGS"
rhughes@241
   230
fi
rhughes@241
   231
rhughes@241
   232
# *****************************
rhughes@241
   233
# Make available to Makefile.am
rhughes@241
   234
# *****************************
rhughes@241
   235
AC_SUBST(SYSCONFDIR, $sysconfdir)
rhughes@241
   236
rhughes@241
   237
# ********************
rhughes@241
   238
# Internationalisation
rhughes@241
   239
# ********************
rhughes@241
   240
ali@319
   241
IT_PROG_INTLTOOL([0.35.0])
rhughes@241
   242
GETTEXT_PACKAGE=razor
rhughes@241
   243
AC_SUBST([GETTEXT_PACKAGE])
rhughes@241
   244
AM_GLIB_GNU_GETTEXT
rhughes@241
   245
AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[gettext domain])
rhughes@241
   246
krh@262
   247
GTK_DOC_CHECK([1.9])
krh@262
   248
rhughes@241
   249
AC_OUTPUT([
rhughes@241
   250
Makefile
rhughes@241
   251
data/razor.pc
rhughes@241
   252
data/Makefile
rhughes@241
   253
librazor/Makefile
ali@364
   254
librazor/types/Makefile
rhughes@241
   255
src/Makefile
rhughes@241
   256
docs/Makefile
krh@262
   257
docs/version.xml
rhughes@241
   258
po/Makefile.in
ali@323
   259
gl/Makefile
ali@351
   260
test/Makefile
rhughes@241
   261
])
rhughes@241
   262
rhughes@241
   263
dnl ==========================================================================
rhughes@241
   264
echo "
rhughes@241
   265
                  razor $VERSION
rhughes@241
   266
                =================
rhughes@241
   267
rhughes@241
   268
        prefix:                     ${prefix}
rhughes@241
   269
        libdir:                     ${libdir}
rhughes@241
   270
        libexecdir:                 ${libexecdir}
rhughes@241
   271
        bindir:                     ${bindir}
rhughes@241
   272
        sbindir:                    ${sbindir}
rhughes@241
   273
        datadir:                    ${datadir}
rhughes@241
   274
        sysconfdir:                 ${sysconfdir}
rhughes@241
   275
        localstatedir:              ${localstatedir}
rhughes@241
   276
        docdir:                     ${docdir}
rhughes@241
   277
rhughes@241
   278
        compiler:                   ${CC}
rhughes@241
   279
        cflags:                     ${CFLAGS}
rhughes@241
   280
        Maintainer mode:            ${USE_MAINTAINER_MODE}
rhughes@241
   281
        Building verbose mode:      ${enable_verbose_mode}
krh@294
   282
        Building gtk-doc:           ${enable_gtk_doc}
rhughes@241
   283
"