configure.in 9.8 KB
Newer Older
Dave Camp's avatar
Dave Camp committed
1
AC_INIT(gdlConf.sh.in)
2
AM_PROG_XML_I18N_TOOLS
3 4 5 6 7 8 9 10

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 ==========================================================================

Naba Kumar's avatar
Naba Kumar committed
11
GLIB_REQUIRED=1.2.0
12 13 14 15 16
GTK_REQUIRED=1.2.0
GNOME_LIBS_REQUIRED=1.2.9
BONOBO_REQUIRED=1.0.7
OAF_REQUIRED=0.6.5
GNOME_VFS_REQUIRED=1.0
17
LIBXML_REQUIRED=1.8.15
Naba Kumar's avatar
Naba Kumar committed
18
GAL_REQUIRED=0.8.0
19

Naba Kumar's avatar
Naba Kumar committed
20
AC_SUBST(GLIB_REQUIRED)
21 22 23 24 25
AC_SUBST(GTK_REQUIRED)
AC_SUBST(GNOME_LIBS_REQUIRED)
AC_SUBST(BONOBO_REQUIRED)
AC_SUBST(OAF_REQUIRED)
AC_SUBST(GNOME_VFS_REQUIRED)
26
AC_SUBST(LIBXML_REQUIRED)
Naba Kumar's avatar
Naba Kumar committed
27
AC_SUBST(GAL_REQUIRED)
28 29 30

dnl ==========================================================================

Dave Camp's avatar
Dave Camp committed
31 32 33
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(gdl,0.1.0)

Dave Camp's avatar
Dave Camp committed
34 35
AM_ACLOCAL_INCLUDE(macros)

Dave Camp's avatar
Dave Camp committed
36 37
AM_MAINTAINER_MODE

Naba Kumar's avatar
Naba Kumar committed
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234
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,
[
	AC_MSG_CHECKING("if $1 is defined in $2")
	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
AC_PROG_RANLIB
AM_PROG_CC_STDC
AC_HEADER_STDC

dnl Checks for programs.
AC_CHECK_PROG(GLIB_CONFIG, glib-config, true, false)

dnl Checks for libraries.
GLIB_LIBS="`glib-config --libs`"
AC_SUBST(GLIB_LIBS)

dnl Checks for header files.
GLIB_CFLAGS="`glib-config --cflags`"
AC_SUBST(GLIB_CFLAGS)
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

AC_MSG_CHECKING("for fpos_t")
AC_EGREP_HEADER(fpos_t, stdio.h, AC_MSG_RESULT(yes),
[
    AC_MSG_RESULT(no)
    AC_DEFINE(fpos_t, long)
])

AC_MSG_CHECKING("for clock_t")
AC_EGREP_HEADER(clock_t, time.h, AC_MSG_RESULT(yes),
[
    AC_MSG_RESULT(no)
    AC_DEFINE(clock_t, long)
])

CHECK_HEADER_DEFINE(L_tmpnam, stdio.h,, AC_DEFINE(L_tmpnam, 20))

CHECK_HEADER_DEFINE(INT_MAX, limits.h,,
    CHECK_HEADER_DEFINE(MAXINT, limits.h,
        AC_DEFINE(INT_MAX, MAXINT), AC_DEFINE(INT_MAX, 32767)))

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
    AC_DEFINE(HAVE_STAT_ST_INO)
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,,
            AC_DEFINE(SEEK_SET, 0)))
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)
        AC_DEFINE_UNQUOTED(TMPDIR, "$tmpdir")
    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,
    CHECK_HEADER_DEFINE(remove, unistd.h,, AC_DEFINE(remove, unlink)))

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
            AC_MSG_CHECKING("putenv prototype")
            AC_EGREP_HEADER([[^A-Za-zo-9_]putenv[   ]*\(.*const.*\)[    ]*;],
                stdlib.h, AC_MSG_RESULT(correct),
                [
                    AC_MSG_RESULT(no const)
                    AC_DEFINE(NON_CONST_PUTENV_PROTOTYPE)
                ])
        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);
}],regcomp_works=yes,regcomp_works=no,AC_DEFINE(CHECK_REGCOMP))
    AC_MSG_RESULT($regcomp_works)
    if test yes != "$regcomp_works"; then
        AC_DEFINE(REGCOMP_BROKEN)
    fi
fi

dnl Checks for missing prototypes
dnl -----------------------------
AC_CHECKING("for missing prototypes")

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]))) AC_MSG_RESULT(adding prototype for $1))])

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 =====================================================================

235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287
dnl
dnl GDL_CHECK_LIB is defined in gdl.m4.  However, we can't use that yet.
dnl So we have a copy here.  If you modify this, see if you should modify
dnl the one in gdl.m4 too.
dnl
AC_DEFUN(CHECK_LIB, [
	dispname="$1"
	pkgname="$2"
	minvers="$3"
	maxvers="$4"

	AC_MSG_CHECKING(for $dispname)

	if gnome-config --libs $pkgname > /dev/null 2>&1; then
		pkgvers=`gnome-config --modversion $pkgname | sed -e 's/^[[^0-9]]*//'`
	else
		pkgvers=not
	fi
	AC_MSG_RESULT($pkgvers found)

	pkgvers=`echo $pkgvers | awk -F. '{ print $[]1 * 1000000 + $[]2 * 10000 + $[]3 * 100 + $[]4;}'`
	cmpminvers=`echo $minvers | awk -F. '{ print $[]1 * 1000000 + $[]2 * 10000 + $[]3 * 100 + $[]4;}'`
	cmpmaxvers=`echo $maxvers | awk -F. '{ print $[]1 * 1000000 + $[]2 * 10000 + $[]3 * 100 + $[]4;}'`
	ok=yes
	if test "$pkgvers" -lt $cmpminvers; then
		ok=no
	elif test -n "$maxvers" -a "$pkgvers" -ge $cmpmaxvers; then
		ok=no
	fi
	if test $ok = no; then
		case $maxvers in
		"")
			dispvers="$minvers or higher"
			;;
		$minvers)
			dispvers="$minvers (exactly)"
			;;
		*)
			dispvers="$minvers or higher, but less than $maxvers,"
			;;
		esac

		AC_MSG_ERROR([
""
"You need $dispname $dispvers to build GDL"
"If you think you already have this installed, consult the README."])
	fi

	tmp_bsnom=`echo $pkgname | tr a-z A-Z`
	eval $tmp_bsnom'_CFLAGS'=\"`gnome-config --cflags $pkgname`\"
	eval $tmp_bsnom'_LIBS'=\"`gnome-config --libs $pkgname`\"
])

Dave Camp's avatar
Dave Camp committed
288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320
dnl libtool versioning

dnl gdl-0.1.0 = 0
dnl increment if any interfaces have been added; set to 0
dnl  if any interfaces have been removed. removal has 
dnl  precedence over adding, so set to 0 if both happened.
dnl AKA Major
GDL_AGE=0

dnl gdl-0.1.0 = 1
dnl increment any time the source changes; set to 
dnl  0 if you increment CURRENT
dnl AKA Minor
GDL_REVISION=1

dnl gdl-0.1.0 = 1
dnl increment if the interface has additions, changes, removals.
dnl AKA Micro
GAL_CURRENT=1

AC_SUBST(GDL_CURRENT)
AC_SUBST(GDL_REVISION)
AC_SUBST(GDL_AGE)

AC_ISC_POSIX
AC_PROG_CC
AC_PROG_CXX
AC_PROG_YACC
AM_PROG_LEX
AC_STDC_HEADERS
AC_ARG_PROGRAM
AM_PROG_LIBTOOL

Dave Camp's avatar
Dave Camp committed
321

Dave Camp's avatar
Dave Camp committed
322 323 324 325
AC_SUBST(CFLAGS)
AC_SUBST(CPPFLAGS)
AC_SUBST(LDFLAGS)

Dave Camp's avatar
Dave Camp committed
326 327 328 329 330 331 332 333
GNOME_INIT()
GNOME_COMPILE_WARNINGS
GNOME_X_CHECKS

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

Naba Kumar's avatar
Naba Kumar committed
334
CHECK_LIB(glib, glib, $GLIB_REQUIRED)
335 336 337 338 339
CHECK_LIB(gnome-libs, gnome, $GNOME_LIBS_REQUIRED)
CHECK_LIB(Bonobo, bonobo, $BONOBO_REQUIRED)
CHECK_LIB(Bonobo X, bonobox, $BONOBO_REQUIRED)
CHECK_LIB(OAF, oaf, $OAF_REQUIRED)
CHECK_LIB(GNOME-VFS, vfs, $GNOME_VFS_REQUIRED)
340
CHECK_LIB(libxml, xml, $LIBXML_REQUIRED)
Naba Kumar's avatar
Naba Kumar committed
341
CHECK_LIB(gal, gal, $GAL_REQUIRED)
Dave Camp's avatar
Dave Camp committed
342 343 344

IDL_CFLAGS=`gnome-config --cflags idl`

Naba Kumar's avatar
Naba Kumar committed
345
AC_SUBST(GLIB_CFLAGS)
Dave Camp's avatar
Dave Camp committed
346 347 348 349 350
AC_SUBST(BONOBO_CFLAGS)
AC_SUBST(BONOBO_LIBS)
AC_SUBST(BONOBOX_CFLAGS)
AC_SUBST(BONOBOX_LIBS)
AC_SUBST(OAF_CFLAGS)
Dave Camp's avatar
Dave Camp committed
351 352
AC_SUBST(VFS_CFLAGS)
AC_SUBST(VFS_LIBS)
Dave Camp's avatar
Dave Camp committed
353
AC_SUBST(IDL_CFLAGS)
354 355
AC_SUBST(XML_CFLAGS)
AC_SUBST(XML_LIBS)
Naba Kumar's avatar
Naba Kumar committed
356
AC_SUBST(GAL_LIBS)
Dave Camp's avatar
Dave Camp committed
357 358 359 360

GNOME_IDL_DIR="`$GNOME_CONFIG --datadir`/idl"

AM_GNOME_GETTEXT
Simos Xenitellis's avatar
Simos Xenitellis committed
361
ALL_LINGUAS="da el it ru sv"
Dave Camp's avatar
Dave Camp committed
362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377
gnomelocaledir='${prefix}/${DATADIRNAME}/locale'
AC_SUBST(gnomelocaledir)

GDL_LIBDIR='-L${libdir}'
GDL_INCLUDEDIR=" -I${includedir} `$GNOME_CONFIG --cflags gnomeui ` $UNICODE_LIBS"
GDL_LIBS="-lgdl `$GNOME_CONFIG --libs bonobox`"
AC_SUBST(GDL_LIBDIR)
AC_SUBST(GDL_INCLUDEDIR)
AC_SUBST(GDL_LIBS)

AC_OUTPUT([
Makefile
gdl/Makefile
idl/Makefile
scintilla-control/Makefile
scintilla-control/scintilla/Makefile
Naba Kumar's avatar
Naba Kumar committed
378 379 380
symbol-browser-control/Makefile
symbol-browser-control/tagmanager/Makefile
symbol-browser-control/tagmanager/include/Makefile
Dave Camp's avatar
Dave Camp committed
381 382 383
intl/Makefile
po/Makefile.in 
stamp.h
384
gdl.spec
Dave Camp's avatar
Dave Camp committed
385
],[sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile])