summaryrefslogtreecommitdiff
path: root/configure.in
blob: 2c435efdbd28ca2dfe73d00ef0e55de9769756a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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
dnl -*- mode: shell-script -*-
dnl Process this file with autoconf to produce a configure script.

m4_define([libidl_major_version], [0])
m4_define([libidl_minor_version], [8])
m4_define([libidl_micro_version], [14])
m4_define([libidl_version], [libidl_major_version.libidl_minor_version.libidl_micro_version])

# Before making a release, the LT_VERSION string should be modified.
# The string is of the form C:R:A.
# - If interfaces have been changed or added, but binary compatibility
# has
#   been preserved, change to C+1:0:A+1
# - If binary compatibility has been broken (eg removed or changed
# interfaces)
#   change to C+1:0:0
# - If the interface is the same as the previous version, change to
# C:R+1:A
m4_define([lt_version], [0:0:0])

dnl the forth argument is because AC_INIT will lowercase the package name
dnl if left off.
AC_INIT([libIDL], [libidl_version],
        [http://bugzilla.gnome.org/enter_bug.cgi?product=libIDL],
        [libIDL])
AC_CONFIG_SRCDIR([include/libIDL/IDL.h.in])

AM_INIT_AUTOMAKE([1.9 no-define no-dist-gzip dist-bzip2])

m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])

AC_SUBST(LIBIDL_MAJOR_VERSION, [libidl_major_version])
AC_SUBST(LIBIDL_MINOR_VERSION, [libidl_minor_version])
AC_SUBST(LIBIDL_MICRO_VERSION, [libidl_micro_version])
AC_SUBST(LIBIDL_VERSION, [libidl_version])
AC_SUBST(LT_VERSION, [lt_version])
AC_DEFINE_UNQUOTED(LIBIDL_VERSION, ["libidl_version"],
                   [the libIDL version number])

dnl --disable-comile-warnings
AC_ARG_ENABLE(compile-warnings,
  AC_HELP_STRING([--enable-compile-warnings=@<:@no/yes@:>@],
                 [Turn on compiler warnings.]),,
  [enable_compile_warnings="yes"])

dnl Make sure that $ACLOCAL_FLAGS is passed to subsequent aclocal runs.
ACLOCAL_AMFLAGS="\${ACLOCAL_FLAGS}"
AC_SUBST([ACLOCAL_AMFLAGS])

AC_ISC_POSIX

dnl Checks for programs.
AC_PROG_CC
AC_PROG_CPP
AC_CPP_ACCEPT_IDL
if [[ "$ac_cv_cpp_accept_idl" = "no" ]]; then
	AC_MSG_WARN(CPP does not accept IDL)
fi
AC_CPP_PIPE_STDIN
CPP_PROGRAM="$CPP"
AC_DEFINE_UNQUOTED(CPP_PROGRAM, "$CPP")

AM_PROG_LEX
if [[ "$LEX" != "flex" ]]; then
	AC_MSG_ERROR(flex is required to create the libIDL scanner)
fi
LFLAGS="-8"
AC_SUBST(LFLAGS)

AC_PROG_YACC
dnl determine if a usable yacc is available on this system
AC_CHECK_PROG(HAVE_YACC, $YACC, yes, no)
if [[ "$HAVE_YACC" = "no" ]]; then
	AC_MSG_ERROR($YACC is not usable as yacc - consider using bison)
fi

AC_LIBTOOL_WIN32_DLL
AM_PROG_LIBTOOL
AM_MAINTAINER_MODE

AC_MSG_CHECKING([for Win32])
case "$host" in
  *-*-mingw*)
    os_win32=yes
    ;;
  *)
    os_win32=no
    
    ;;
esac
AC_MSG_RESULT([$os_win32])
AM_CONDITIONAL(OS_WIN32, [test $os_win32 = yes])

dnl Checks for libraries.
PKG_CHECK_MODULES(LIBIDL, glib-2.0 >= 2.4.0)

AC_STDC_HEADERS
AC_CHECK_HEADERS(stddef.h)
AC_CHECK_HEADERS(unistd.h)
AC_CHECK_HEADERS(wchar.h, HAVE_WCHAR_H=1)
AC_CHECK_HEADERS(wcstr.h, HAVE_WCSTR_H=1)
if test -z "$HAVE_WCHAR_H"; then 
	HAVE_WCHAR_H=0
fi
if test -z "$HAVE_WCSTR_H"; then
	HAVE_WCSTR_H=0
fi
AC_SUBST(HAVE_WCHAR_H)
AC_SUBST(HAVE_WCSTR_H)
AC_CHECK_FUNCS(popen symlink access)

dnl glib requires a 64-bit type
dnl to support MSVC add __int64
AC_CHECK_SIZEOF(long long)

AC_MSG_CHECKING(for format to printf and scanf a guint64)
AC_CACHE_VAL(libIDL_cv_long_long_format,[
    for format in ll q I64; do
	AC_TRY_RUN([#include <stdio.h>
	    #include <stdlib.h>  
	    int main()
	    {
		long long b, a = -0x3AFAFAFAFAFAFAFALL;
		char buffer[1000];
		sprintf (buffer, "%${format}u", a);
  		sscanf (buffer, "%${format}u", &b);
		exit (b!=a);
	    }
	    ],
	    libIDL_cv_long_long_format=${format}
	    break)
	done])
if test -n "$libIDL_cv_long_long_format"; then
    AC_MSG_RESULT(%${libIDL_cv_long_long_format}u)
    IDL_LL="\"${libIDL_cv_long_long_format}\""
    AC_SUBST(IDL_LL)
else
    AC_MSG_RESULT(none)
    AC_MSG_ERROR([
*** libIDL requires a 64 bit format type.
])
fi


if test "x$GCC" = "xyes" -a "x$enable_compile_warnings" != "xno"; then
        WARN_CFLAGS="-Wall -Wunused -Wmissing-prototypes -Wmissing-declarations"
else
        WARN_CFLAGS=
fi

AC_MSG_CHECKING(what warning flags to pass to the C compiler)
AC_MSG_RESULT($WARN_CFLAGS)
AC_SUBST(WARN_CFLAGS)

AC_CONFIG_FILES([
Makefile
Makefile.msc
libIDL-zip
include/Makefile
include/libIDL/Makefile
include/libIDL/IDL.h
libIDL-config-2
libIDL.m4
libIDL.spec
libIDL-2.0.pc
libIDL-2.0-uninstalled.pc
])

AC_OUTPUT

echo
echo libIDL $LIBIDL_VERSION configuration complete
echo
echo "  C Preprocessor: \"$CPP_PROGRAM\""
if [[ "$ac_cv_cpp_pipe_stdin" = "yes" ]]; then
	echo "  Standard input supported."
else
	echo "  Using symlink method."
fi
echo