File: configure.in

package info (click to toggle)
yudit 2.8.1-4
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 11,988 kB
  • sloc: cpp: 63,619; perl: 4,263; ansic: 1,957; makefile: 895; sh: 320
file content (326 lines) | stat: -rwxr-xr-x 6,438 bytes parent folder | download | duplicates (3)
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
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
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
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
321
322
323
324
325
326
#  configure.in version 2.5
#  yudit package - Unicode Editor for the X Window System (and Linux) 
#
#  Author: gaspar@yudit.org (Gaspar Sinai)
#  GNU Copyright (C) 1997-2006  Gaspar Sinai
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License, version 2,
#  dated June 1991, by the Free Software Foundation.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software
#  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
dnl Process this file with autoconf to produce a configure script.
AC_INIT(gui/SYudit.h)

AC_PREFIX_DEFAULT(/usr)

dnl Checks for programs.
AC_PROG_CXX
AC_PROG_CXXCPP
AC_PROG_CC
dnl AC_PROG_INSTALL

dnl Unfortunatelly hpux does not have mmap that is
dnl considered good by configure
dnl AC_FUNC_MMAP

AC_PATH_XTRA

AC_PATH_PROG(RANLIB, ranlib)
if test x$RANLIB = x; then
   RANLIB=":"
fi

LPR_COMMAND=""
LPR_CFLAGS="-DLPR_COMMAND=\\\"/bin/lpr\\\""
AC_PATH_PROG(LPR_COMMAND,lpr)

if test x$LPR_COMMAND = x; then
   LPR_CFLAGS="-DLPR_COMMAND=\\\"/bin/lpr\\\""
else
   LPR_CFLAGS="-DLPR_COMMAND=\\\"${LPR_COMMAND}\\\""
fi

AC_SUBST(LPR_CFLAGS)

dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(unistd.h)

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE

dnl Checks for library functions.
AC_CHECK_FUNCS(strtol)

AC_LANG_SAVE
AC_LANG_C

AC_MSG_CHECKING(long long )
HAVE_LONG_LONG=
AC_TRY_COMPILE([ #include <sys/types.h> ],
	[ u_int64_t a; ],
	[HAVE_LONG_LONG=-DHAVE_LONG_LONG])

AC_TRY_COMPILE([ #include <stdio.h> ],
	[ unsigned long long  a; ],
	[HAVE_LONG_LONG=-DHAVE_LONG_LONG])

if test x$HAVE_LONG_LONG = x ; then
	AC_MSG_RESULT(no)
else
	AC_MSG_RESULT(yes)
fi

AC_MSG_CHECKING(memmove )
NO_MEMMOVE="-DNO_MEMMOVE"
AC_TRY_LINK([ #include <string.h> ],
	[ char*a; char*b; memmove(a,b,1); ],
	[NO_MEMMOVE=])

if test x$NO_MEMMOVE = x ; then
	AC_MSG_RESULT(yes)
else
	AC_MSG_RESULT(no)
fi

CPPFLAGS="$HAVE_LONG_LONG $NO_MEMMOVE $CPPFLAGS"

AC_LANG_RESTORE

AC_SUBST(HAVE_LONG_LONG)


dnl
dnl solaris has this library outside libc
dnl

SOCKET_FLAGS=-lsocket

AC_TRY_LINK([#include <sys/socket.h>],
	[ socket(1,1,1);] , 
	[ SOCKET_FLAGS= ])

dnl 
dnl check if it is real
dnl
if test x$SOCKET_FLAGS = x-lsocket
then

SAVELD=$LIBS
LIBS="$SAVELD -lsocket"

AC_TRY_LINK([#include <sys/socket.h>],
	[ sockett(1,1,1);] , 
	[ SOCKET_FLAGS=-lsocket ], [ SOCKET_FLAGS= ])

LIBS="$SAVELD $SOCKET_FLAGS"

fi

AC_MSG_CHECKING(libsocket )
if test x$SOCKET_FLAGS = x-lsocket
then
	AC_MSG_RESULT(needed)
else
	AC_MSG_RESULT(not needed)
fi

dnl
dnl solaris has this library outside libc
dnl
AC_MSG_CHECKING(nsl )

NSL_FLAGS=-lnsl

AC_TRY_LINK([#include <netdb.h>],
	[ gethostbyname("localhost");] , 
	[ NSL_FLAGS= ])

dnl 
dnl check if it is real
dnl
if test x$NSL_FLAGS = x-nsl
then

SAVELD=$LIBS
LIBS="$SAVELD -lnsl"

AC_TRY_LINK([#include <netdb.h>],
	[ gethostbyname("localhost");] , 
	[ NSL_FLAGS=-lnsl ], [ NSL_FLAGS= ])

LIBS="$SAVELD $NSL_FLAGS"

fi

if test x$NSL_FLAGS = x-nsl
then
	AC_MSG_RESULT(needed)
else
	AC_MSG_RESULT(not needed)
fi

dnl
dnl People complained that gettext distribution does not have it.
dnl
MSGMERGE=
AC_PATH_PROG(MSGMERGE, msgmerge)
if test x$MSGMERGE = x; then
   MSGMERGE=":"
fi

dnl
dnl finding xgettext to find the libs
dnl version > 2.4  does not need it.
dnl 
GETTEXT_CFLAGS=
GETTEXT_LFLAGS=

TOPDIR=`pwd`
AC_SUBST(TOPDIR)
AC_SUBST(MSGMERGE)
AC_SUBST(GETTEXT_CFLAGS)
AC_SUBST(GETTEXT_LFLAGS)

AC_TRY_LINK([ #include <X11/Xlocale.h> ],
        [ setlocale(LC_ALL,"C"); ] ,
        [ HAVE_LOCALE=-DHAVE_LOCALE ],
        [ HAVE_LOCALE= ])

SAVELD=$LIBS
SAVECFLAGS=$CLFAGS

LIBS="$X_EXTRA_LIBS $X_LIBS -lX11 $LIBS"
CLFAGS="$X_CFLAGS $CLFAGS"

AC_TRY_LINK([ #include <X11/Xlib.h> 
extern char *
XSetIMValues(
#if NeedVarargsPrototypes
    XIM /* im */, ...
#endif
);
],
        [ XSetIMValues (0, XNDestroyCallback , 0, 0); ] ,
        [ HAVE_SET_IM_VALUES=-DHAVE_SET_IM_VALUES; NEED_SET_IM_VALUES_PROTO=-DNEED_SET_IM_VALUES_PROTO ],
        [ NEED_SET_IM_VALUES_PROTO= ])

if test x$HAVE_SET_IM_VALUES = x ; then
AC_TRY_LINK([ #include <X11/Xlib.h> ],
        [ XSetIMValues (0, XNDestroyCallback , 0, 0); ] ,
        [ HAVE_SET_IM_VALUES=-DHAVE_SET_IM_VALUES ],
        [ HAVE_SET_IM_VALUES= ])

fi

LIBS=$SAVELD
CLFAGS=$SAVECFLAGS

AC_SUBST(HAVE_LOCALE)
AC_SUBST(HAVE_SET_IM_VALUES)
AC_SUBST(NEED_SET_IM_VALUES_PROTO)

AC_MSG_CHECKING(locale )

if test x$HAVE_LOCALE = x ; then
	AC_MSG_RESULT(no)
else
	AC_MSG_RESULT(yes)
fi

if test x$no_x != xyes
then
  AC_MSG_CHECKING(XSetIMValues )
  if test x$HAVE_SET_IM_VALUES = x ; then
  	AC_MSG_RESULT(no)
  else
    AC_MSG_RESULT(yes)
  fi
fi

#
# Sorry guys this autoconf program is a monster - useful features are missing 
#
cat > /tmp/gaspar$$.sh <<+
prefix=${prefix}
if test  ${prefix} = NONE
then
  prefix=${ac_default_prefix}
fi
echo ${datadir}/yudit
+

YUDIT_DATA=`sh /tmp/gaspar$$.sh`

/bin/rm -f /tmp/gaspar$$.sh 

#
# Check if I can compile with cc
#
CAN_USE_CC="0"
cat > /tmp/gaspar$$.cpp <<+
#include <stdio.h>

class A{
 public:
    A(void) {};
    ~A() {};
    void print(void) {
      fprintf (stderr, "Hi\n");
    }
};

int
main(int argc, char* argv[])
{
  A a;
  a.print();
  // gcc 3.xx does not handle it without c++
  A* aa = new A();
  aa->print();
  delete aa;
  try { throw A(); } catch (A& ea) {}
  return (0);
}
+

AC_MSG_CHECKING(c++ or c compiler to use )
${CC} -o /tmp/gaspar$$ /tmp/gaspar$$.cpp 2> /dev/null 1> /dev/null

if test $? = 0 
then
  CAN_USE_CC="1"
  AC_MSG_RESULT($CC)
  CXX=$CC
else
  AC_MSG_RESULT($CXX)
fi

/bin/rm -f  /tmp/gaspar$$ /tmp/gaspar$$.cpp


AC_SUBST(YUDIT_DATA)

if test x$no_x = xyes
then
  USE_X11=-DUSE_X11=0
  X11_LIB=
else
  USE_X11=-DUSE_X11=1
  X11_LIB=-lX11
fi

AC_SUBST(USE_X11)
AC_SUBST(X11_LIB)

AC_OUTPUT(Makefile.conf uniconv/uniconv.1 uniprint/uniprint.1 yudit.properties doc/FAQ.TXT doc/vi/FAQ.TXT doc/de/FAQ.TXT doc/hu/FAQ.TXT doc/ko/FAQ.TXT doc/ja/FAQ.TXT doc/yi/FAQ.TXT doc/es/FAQ.TXT doc/fi/FAQ.TXT doc/ru/FAQ.TXT doc/te/FAQ.TXT doc/sr/FAQ.TXT doc/zh/FAQ.TXT doc/cs/FAQ.TXT doc/bg/FAQ.TXT doc/it/FAQ.TXT Makefile)