configure.in 8.81 KB
Newer Older
1 2 3 4 5 6 7 8
dnl ==========================================================================
dnl
dnl If you add a version number here, you *must* add an AC_SUBST line for
dnl it too, or it will never make it into the spec file!
dnl
dnl ==========================================================================


9 10
AC_PREREQ(2.13)
AC_INIT(gdl)
11
AM_CONFIG_HEADER(config.h)
12

13 14 15 16 17 18 19
GDL_MAJOR_VERSION=0
GDL_MINOR_VERSION=3
GDL_MICRO_VERSION=0
PACKAGE=gdl
GDL_VERSION=$GDL_MAJOR_VERSION.$GDL_MINOR_VERSION.$GDL_MICRO_VERSION

AM_INIT_AUTOMAKE($PACKAGE, $GDL_VERSION)
20 21

AC_PROG_INTLTOOL
22

23 24 25 26
AC_SUBST(GDL_MAJOR_VERSION)
AC_SUBST(GDL_MINOR_VERSION)
AC_SUBST(GDL_MICRO_VERSION)
AC_SUBST(GDL_VERSION)
Dave Camp's avatar
Dave Camp committed
27

28 29 30
SNAPSHOT=0_`date +%Y%m%d_%H%M%S`_cvs
AC_SUBST(SNAPSHOT)

31
GTK_REQUIRED=1.3.9
32
GNOME_REQUIRED=2.1.0
33 34
BONOBOUI_REQUIRED=1.108.1
XML_REQUIRED=2.2.8
35
LIBGLADE_REQUIRED=1.99.5
36
LIBRSVG_REQUIRED=1.1.1
37 38 39

AC_SUBST(GTK_REQUIRED)
AC_SUBST(GNOME_REQUIRED)
40
AC_SUBST(BONOBOUI_REQUIRED)
41
AC_SUBST(XML_REQUIRED)
42
AC_SUBST(LIBGLADE_REQUIRED)
43
AC_SUBST(LIBRSVG_REQUIRED)
Dave Camp's avatar
Dave Camp committed
44

Dave Camp's avatar
Dave Camp committed
45 46
AM_MAINTAINER_MODE

47 48 49
AC_ISC_POSIX
AC_PROG_CC

Naba Kumar's avatar
Naba Kumar committed
50 51 52 53 54 55 56 57
dnl =====================================================================
dnl ======== Ctags stuffs below =========================================

dnl Define convenience macros
dnl -------------------------
dnl CHECK_HEADER_DEFINE(LABEL, HEADER [,ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ] ])
AC_DEFUN(CHECK_HEADER_DEFINE,
[
58
	AC_MSG_CHECKING(if $1 is defined in $2)
Naba Kumar's avatar
Naba Kumar committed
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
	AC_EGREP_CPP(yes,
[#include <$2>
#ifdef $1
  yes
#endif
], [
	AC_MSG_RESULT(yes)
	$3
], [
	AC_MSG_RESULT(no)
	$4
]) ])

AC_ISC_POSIX
AC_PROG_CC
AM_PROG_CC_STDC
AC_HEADER_STDC

77 78
dnl Check for glib.
PKG_CHECK_MODULES(GLIB, glib-2.0)
Naba Kumar's avatar
Naba Kumar committed
79 80
AC_SUBST(GLIB_LIBS)
AC_SUBST(GLIB_CFLAGS)
81 82

dnl Check for other things
Naba Kumar's avatar
Naba Kumar committed
83 84 85 86 87 88 89 90 91 92 93 94 95 96
AC_CHECK_HEADERS(dirent.h fcntl.h fnmatch.h stat.h stdlib.h string.h)
AC_CHECK_HEADERS(time.h types.h unistd.h)
AC_CHECK_HEADERS(sys/dir.h sys/stat.h sys/times.h sys/types.h)

dnl Checks for typedefs, structures, and compiler characteristics.
AC_CYGWIN
AC_MINGW32
AC_C_CONST
AC_OBJEXT
AC_EXEEXT

AC_TYPE_SIZE_T
AC_TYPE_OFF_T

97
AC_MSG_CHECKING(for fpos_t)
Naba Kumar's avatar
Naba Kumar committed
98 99 100
AC_EGREP_HEADER(fpos_t, stdio.h, AC_MSG_RESULT(yes),
[
    AC_MSG_RESULT(no)
101
    AC_DEFINE(fpos_t, long, [Portable fpos_t type])
Naba Kumar's avatar
Naba Kumar committed
102 103
])

104
AC_MSG_CHECKING(for clock_t)
Naba Kumar's avatar
Naba Kumar committed
105 106 107
AC_EGREP_HEADER(clock_t, time.h, AC_MSG_RESULT(yes),
[
    AC_MSG_RESULT(no)
108
    AC_DEFINE(clock_t, long, [Portable clock_t type])
Naba Kumar's avatar
Naba Kumar committed
109 110
])

111 112 113
CHECK_HEADER_DEFINE(L_tmpnam, stdio.h,, AC_DEFINE(L_tmpnam, 20, 
	[How long an array of chars must be to be passed to tmpnam]))

Naba Kumar's avatar
Naba Kumar committed
114 115 116

CHECK_HEADER_DEFINE(INT_MAX, limits.h,,
    CHECK_HEADER_DEFINE(MAXINT, limits.h,
117 118
        AC_DEFINE(INT_MAX, MAXINT, [Maximum integer value]), 
	AC_DEFINE(INT_MAX, 32767, [Maximum integer value])))
Naba Kumar's avatar
Naba Kumar committed
119 120 121 122 123 124 125 126 127 128

AC_MSG_CHECKING(if struct stat contains st_ino)
AC_TRY_COMPILE([#include <sys/stat.h>], [
    struct stat st;
    stat(".", &st);
    if (st.st_ino > 0)
        exit(0);
], have_st_ino=yes, have_st_ino=no)
AC_MSG_RESULT($have_st_ino)
if test yes = "$have_st_ino"; then
129
    AC_DEFINE(HAVE_STAT_ST_INO, 1, [Defined if stat struct contains st_ino])
Naba Kumar's avatar
Naba Kumar committed
130 131 132 133 134 135 136 137 138 139 140 141 142 143
fi

dnl Checks for library functions.
AC_CHECK_FUNCS(fnmatch)
AC_CHECK_FUNCS(strstr)
AC_CHECK_FUNCS(stricmp)
AC_CHECK_FUNCS(strnicmp)

AC_CHECK_FUNCS(fgetpos, have_fgetpos=yes)

dnl SEEK_SET should be in stdio.h, but may be in unistd.h on SunOS 4.1.x
if test "$have_fgetpos" != yes ; then
    CHECK_HEADER_DEFINE(SEEK_SET, stdio.h,,
        CHECK_HEADER_DEFINE(SEEK_SET, unistd.h,,
144
            AC_DEFINE(SEEK_SET, 0, [Seek from the beginning of file])))
Naba Kumar's avatar
Naba Kumar committed
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160
fi

AC_CHECK_FUNCS(mkstemp, have_mkstemp=yes)
if test "$have_mkstemp" != yes ; then
    AC_CHECK_FUNCS(chmod)
    if test "$tmpdir_specified" = yes ; then
        AC_MSG_RESULT(use of tmpnam overrides temporary directory selection)
    fi
else
    AC_MSG_CHECKING(directory to use for temporary files)
    if test -z "$enable_tmpdir" -o "$enable_tmpdir" = no -o "$enable_tmpdir" = yes ;
        then tmpdir=/tmp
        else tmpdir="$enable_tmpdir"
    fi
    if test -d $tmpdir ; then
        AC_MSG_RESULT($tmpdir)
161
        AC_DEFINE_UNQUOTED(TMPDIR, "$tmpdir", [Directory for temporary files])
Naba Kumar's avatar
Naba Kumar committed
162 163 164 165 166 167 168 169
    else
        AC_MSG_WARN($tmpdir does not exist)
    fi
fi

AC_CHECK_FUNCS(strerror opendir)
AC_CHECK_FUNCS(clock times, break)
AC_CHECK_FUNCS(remove, have_remove=yes,
170
    CHECK_HEADER_DEFINE(remove, unistd.h,, AC_DEFINE(remove, unlink, [Portable remove])))
Naba Kumar's avatar
Naba Kumar committed
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187

AC_CHECK_FUNCS(truncate, have_truncate=yes)
dnl === Cannot nest AC_CHECK_FUNCS() calls
if test "$have_truncate" != yes  ; then
    AC_CHECK_FUNCS(ftruncate, have_ftruncate=yes)
    if test "$have_ftruncate" != yes ; then
        AC_CHECK_FUNCS(chsize)
    fi
fi

AC_CHECK_FUNCS(setenv, have_setenv=yes)
dnl === Cannot nest AC_CHECK_FUNCS() calls
if test "$have_setenv" != yes ; then
    AC_CHECK_FUNCS(putenv, have_putenv=yes)
    if test "$have_putenv" = yes ; then
        AC_EGREP_HEADER(putenv, stdlib.h, have_putenv_prototype=yes)
        if test "$have_putenv_prototype" = yes ; then
188
            AC_MSG_CHECKING(putenv prototype)
Naba Kumar's avatar
Naba Kumar committed
189 190 191 192
            AC_EGREP_HEADER([[^A-Za-zo-9_]putenv[   ]*\(.*const.*\)[    ]*;],
                stdlib.h, AC_MSG_RESULT(correct),
                [
                    AC_MSG_RESULT(no const)
193 194
                    AC_DEFINE(NON_CONST_PUTENV_PROTOTYPE, 1, 
			[Defined if putenv accepts a non-const string])
Naba Kumar's avatar
Naba Kumar committed
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210
                ])
        fi
    fi
fi

dnl
dnl if test yes = "$CYGWIN"; then with_posix_regex=no; fi
if test no != "$with_posix_regex"; then
    AC_CHECK_FUNCS(regcomp)
    AC_MSG_CHECKING(if regcomp works)
    AC_TRY_RUN([
#include <sys/types.h>
#include <regex.h>
main() {
    regex_t patbuf;
    exit (regcomp (&patbuf, "/hello/", 0) != 0);
211
}],regcomp_works=yes,regcomp_works=no,AC_DEFINE(CHECK_REGCOMP, 1, [Defined if regcomp works]))
Naba Kumar's avatar
Naba Kumar committed
212 213
    AC_MSG_RESULT($regcomp_works)
    if test yes != "$regcomp_works"; then
214
        AC_DEFINE(REGCOMP_BROKEN, 1, [Defined if regcomp does not work])
Naba Kumar's avatar
Naba Kumar committed
215 216 217 218 219
    fi
fi

dnl Checks for missing prototypes
dnl -----------------------------
220
AC_CHECKING(for missing prototypes)
Naba Kumar's avatar
Naba Kumar committed
221

222 223 224 225
AC_DEFUN(CHECK_PROTO, [AC_EGREP_HEADER([[^A-Za-z0-9_]$1([   ]+[A-Za-z0-9_]*)?\(], $2,, 
	AC_DEFINE(patsubst([NEED_PROTO_NAME], [NAME], translit($1, [a-z], [A-Z])), 1, 
		[Whether a prototype for $1 is needed]) 
	AC_MSG_RESULT(adding prototype for $1))])
Naba Kumar's avatar
Naba Kumar committed
226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248

if test "$have_remove" = yes ; then
    CHECK_PROTO(remove, stdio.h)
else
    CHECK_PROTO(unlink, unistd.h)
fi
CHECK_PROTO(malloc, stdlib.h)
CHECK_PROTO(getenv, stdlib.h)
CHECK_PROTO(stat,   sys/stat.h)
CHECK_PROTO(lstat,  sys/stat.h)
if test "$have_fgetpos" = yes ; then
    CHECK_PROTO(fgetpos, stdio.h)
fi
if test "$have_truncate" = yes ; then
    CHECK_PROTO(truncate, unistd.h)
fi
if test "$have_ftruncate" = yes ; then
    CHECK_PROTO(ftruncate, unistd.h)
fi

dnl ========== ctags stuffs ends =======================================
dnl =====================================================================

Dave Camp's avatar
Dave Camp committed
249 250 251 252
AC_PROG_CXX
AC_PROG_YACC
AC_STDC_HEADERS
AM_PROG_LIBTOOL
253
AM_SANITY_CHECK
Dave Camp's avatar
Dave Camp committed
254

255
GNOME_PLATFORM_GNOME_2(yes)
256
GNOME_COMPILE_WARNINGS(maximum)
Dave Camp's avatar
Dave Camp committed
257 258 259 260 261

dnl ***************
dnl GNOME Libraries 
dnl ***************

262
PKG_CHECK_MODULES(XML, libxml-2.0 >= $XML_REQUIRED)
263 264
AC_SUBST(XML_CFLAGS)
AC_SUBST(XML_LIBS)
Naba Kumar's avatar
Naba Kumar committed
265
AC_SUBST(GAL_LIBS)
Dave Camp's avatar
Dave Camp committed
266

267 268 269
PKG_CHECK_MODULES(GDL_DEPENDENCIES, 
	gtk+-2.0 >= $GTK_REQUIRED 
	libgnome-2.0 >= $GNOME_REQUIRED
270
	libgnomeui-2.0 >= $GNOME_REQUIRED
271
	libbonoboui-2.0 >= $BONOBOUI_REQUIRED
272 273
	libglade-2.0 >= $LIBGLADE_REQUIRED
	librsvg-2.0 >= $LIBRSVG_REQUIRED)
274 275 276 277 278 279 280 281 282 283 284 285 286
AC_SUBST(GDL_DEPENDENCIES_CFLAGS)
AC_SUBST(GDL_DEPENDENCIES_LIBS)

# orbit-idl
ORBIT_IDL="`$PKG_CONFIG --variable=orbit_idl ORBit-2.0`"
AC_SUBST(ORBIT_IDL)

# idl directories
LIBBONOBO_IDL_DIR="`$PKG_CONFIG --variable=idldir libbonobo-2.0`"
AC_SUBST(LIBBONOBO_IDL_DIR)
BONOBO_ACTIVATION_IDL_DIR="`$PKG_CONFIG --variable=idldir bonobo-activation-2.0`"
AC_SUBST(BONOBO_ACTIVATION_IDL_DIR)

287 288 289 290 291 292
NAUTILUS_THEMEDIR="`$PKG_CONFIG --variable=prefix libnautilus`/share/pixmaps/nautilus"
AC_SUBST(NAUTILUS_THEMEDIR)

GNOME_VFS_ICONDIR="`$PKG_CONFIG --variable=prefix gnome-vfs-2.0`/share/pixmaps/document-icons"
AC_SUBST(GNOME_VFS_ICONDIR)

293 294 295 296 297
# marshal and enum generators
GLIB_GENMARSHAL="`$PKG_CONFIG --variable=glib_genmarshal glib-2.0`"
AC_SUBST(GLIB_GENMARSHAL)
GLIB_MKENUMS="`$PKG_CONFIG --variable=glib_mkenums glib-2.0`"
AC_SUBST(GLIB_MKENUMS)
Dave Camp's avatar
Dave Camp committed
298

299
ALL_LINGUAS="az cs da de el es fr it pt ru sv vi"
300 301
GETTEXT_PACKAGE=gdl-1
AC_SUBST(GETTEXT_PACKAGE)
302 303 304
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Package name for gettext])
AC_DEFINE_UNQUOTED(GNOME_EXPLICIT_TRANSLATION_DOMAIN, "$GETTEXT_PACKAGE", 
	[Domain for gettext translation])
305 306 307 308 309

AM_GLIB_GNU_GETTEXT

# AM_GNOME2_GETTEXT above substs $DATADIRNAME
# this is the directory where the *.{mo,gmo} files are installed
Dave Camp's avatar
Dave Camp committed
310 311 312 313 314 315
gnomelocaledir='${prefix}/${DATADIRNAME}/locale'
AC_SUBST(gnomelocaledir)

AC_OUTPUT([
Makefile
gdl/Makefile
316 317
symbol-browser-control/Makefile
symbol-browser-control/tagmanager/Makefile
318
symbol-browser-control/tagmanager/include/Makefile
Gustavo Giraldez's avatar
Gustavo Giraldez committed
319
symbol-browser-control/pixmaps/Makefile
Dave Camp's avatar
Dave Camp committed
320 321
idl/Makefile
po/Makefile.in 
322
gdl.spec
323 324
gdl-1.0.pc
])