summaryrefslogtreecommitdiffstats
path: root/configure.in
blob: e8ca9ed394b568269e07c76f1e191a2e19573353 (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
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
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
dnl =======================================================
dnl FILE: ./admin/configure.in.min
dnl =======================================================

dnl    This file is part of the KDE libraries/packages
dnl    Copyright (C) 2001 Stephan Kulow (coolo@kde.org)
 
dnl    This file is free software; you can redistribute it and/or
dnl    modify it under the terms of the GNU Library General Public
dnl    License as published by the Free Software Foundation; either
dnl    version 2 of the License, or (at your option) any later version.
 
dnl    This library is distributed in the hope that it will be useful,
dnl    but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
dnl    Library General Public License for more details.
 
dnl    You should have received a copy of the GNU Library General Public License
dnl    along with this library; see the file COPYING.LIB.  If not, write to
dnl    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
dnl    Boston, MA 02110-1301, USA.

# Original Author was Kalle@kde.org
# I lifted it in some mater. (Stephan Kulow)
# I used much code from Janos Farkas

dnl Process this file with autoconf to produce a configure script.

AC_INIT(acinclude.m4) dnl a source file from your sub dir

dnl This is so we can use kde-common
AC_CONFIG_AUX_DIR(admin)

dnl This ksh/zsh feature conflicts with `cd blah ; pwd`
unset CDPATH

dnl Checking host/target/build systems, for make, install etc.
AC_CANONICAL_SYSTEM 
dnl Perform program name transformation
AC_ARG_PROGRAM

dnl Automake doc recommends to do this only here. (Janos)
AM_INIT_AUTOMAKE(keximdb-1.1.0, "3.5.10") dnl searches for some needed programs

KDE_SET_PREFIX

dnl generate the config header
AC_CONFIG_HEADER(config.h) dnl at the distribution this done

dnl Checks for programs.
AC_PROG_CC
AC_PROG_CXX
AC_CHECK_COMPILERS
AC_ENABLE_SHARED(yes)
AC_ENABLE_STATIC(no)
KDE_PROG_LIBTOOL

dnl for NLS support. Call them in this order!
dnl WITH_NLS is for the po files
AM_KDE_WITH_NLS

KDE_USE_TQT(3.3)
AC_PATH_KDE
dnl =======================================================
dnl FILE: configure.in.in
dnl =======================================================

#MIN_CONFIG(3.3)
# Define a symbol, to know that we're compiling WITH kde. (for apps that
#  can compile without KDE, optionally)
AM_CONDITIONAL(KDE_INSTALLED, test "$have_kde" = "yes")

dnl Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h sys/time.h sys/stat.h stdint.h)
AC_CHECK_HEADERS(sys/cdefs.h fnmatch.h sysent.h strings.h paths.h)
AC_CHECK_HEADERS(utmp.h sys/param.h linux/tcp.h sys/proc.h)

dnl Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_TIME

AC_C_LONG_DOUBLE  

dnl Checks for library functions.
KDE_CHECK_DLOPEN
AC_CHECK_FUNCS(socket fabsl strdup vsnprintf re_comp flock) 
AC_CHECK_SETENV
AC_CHECK_UNSETENV
AC_CHECK_GETDOMAINNAME
AC_CHECK_GETHOSTNAME 
AM_PROG_LEX
LFLAGS="-o${LEX_OUTPUT_ROOT}.c"
AC_SUBST(LFLAGS)


dnl =======================================================
dnl FILE: ./keximdb/configure.in.in
dnl =======================================================

#MIN_CONFIG(3.0)

dnl PACKAGE set before
AC_C_BIGENDIAN
AC_CHECK_KDEMAXPATHLEN

dnl ----------------------------------------------------------------------
dnl These checks based on those in arts configure.in.in

dnl Check for pkg-config
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)

if test "$PKG_CONFIG" = "no"; then
  AC_MSG_ERROR([This package requires pkg-config.])
fi

dnl Check for Glib-2.0
# GLIB_CFLAGS:  cflags for compiling glib dependant sources
# GLIB_LIBADD:  glib libraries (-l options)
# GLIB_LDFLAGS: flags containing path to glib libraries (-L options)

GLIB_PACKAGES="glib-2.0"
GLIB_VERSION="2.4"
AC_MSG_CHECKING(for GLib-2.0 (at least $GLIB_VERSION))

if $PKG_CONFIG --atleast-pkgconfig-version 0.15 ; then
  if $PKG_CONFIG --atleast-version $GLIB_VERSION $GLIB_PACKAGES >/dev/null 2>&1 ; then
    GLIB_CFLAGS="`$PKG_CONFIG --cflags $GLIB_PACKAGES`"
    GLIB_LIBADD="`$PKG_CONFIG --libs-only-l --libs-only-other $GLIB_PACKAGES`"
    GLIB_LDFLAGS="`$PKG_CONFIG --libs-only-L $GLIB_PACKAGES`"
    AC_MSG_RESULT(yes)
  fi
else
  if $PKG_CONFIG --atleast-version $GLIB_VERSION $GLIB_PACKAGES >/dev/null 2>&1 ; then
    GLIB_CFLAGS="`$PKG_CONFIG --cflags $GLIB_PACKAGES`"
    GLIB_LIBADD="`$PKG_CONFIG --libs-only-l $GLIB_PACKAGES`"
    GLIB_LDFLAGS="`$PKG_CONFIG --libs-only-L $GLIB_PACKAGES`"
    AC_MSG_RESULT(yes)
    AC_MSG_WARN([building keximdb with pkg-config < 0.15 is untested.])
  fi
fi

if test -z "$GLIB_LIBADD"; then
  AC_MSG_RESULT(not installed)
  AC_ERROR([Please install glib-2.0 (see http://www.gtk.org).])
  DO_NOT_COMPILE="$DO_NOT_COMPILE keximdb"
fi

# Build without optimisation.  Anything higher than -O0 here causes
# a crash in mdb_read_indices on Northwind.
CFLAGS=`echo "$CFLAGS" | sed 's/ -O2 / -O0 /g'`


AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBADD)
AC_SUBST(GLIB_LDFLAGS)
dnl ----------------------------------------------------------------------
dnl =======================================================
dnl FILE: ./keximdb/src/keximdb/configure.in.in
dnl =======================================================

dnl ====================================================================== 
dnl Configure checks for KexiDB
dnl
dnl This ought to be simple - use tde-config to find headers and libraries 
dnl and link against them:
dnl   `tde-config --prefix`/include
dnl However, tde-config doesn't return the expected directory on Debian 
dnl (for one), which installs kde headers to /usr/include/kde.
dnl 
dnl So the plan for headers is to check:
dnl   `tde-config --prefix`/include,
dnl   `tde-config --prefix`/kde/include,
dnl   any other place we might find them
dnl Then for libraries, check
dnl   `tde-config --prefix`/include,
dnl   any other place we might find them
dnl ====================================================================== 

# Configure overrides
AC_ARG_WITH(kexidb_includes,
AC_HELP_STRING([--with-kexidb-includes=DIR],
  [use KexiDB-includes installed in this directory]),
  [ac_kexidb_incdir=$withval],
  ac_kexidb_incdir="")

AC_ARG_WITH(kexidb_libraries,
AC_HELP_STRING([--with-kexidb-libraries=DIR],
  [use KexiDB-libs installed in this directory ]),
  [ac_kexidb_libdir=$withval],
  ac_kexidb_libdir="")

# Find tde-config

if test "$ac_kexidb_incdir" = "" -o "$ac_kexidb_libdir" = "" ; then
  KDE_FIND_PATH(tde_config,KDE_CONFIG,
    [${prefix}/bin ${exec_prefix}/bin /usr/local/bin /opt/local/bin /usr/bin 
    /opt/kde/bin ], 
    [AC_MSG_ERROR([Could not find tde-config anywhere])])
  kde_prefix=`$KDE_CONFIG --prefix`
fi

# Find include dir
if test "$ac_kexidb_incdir" = "" ; then
  AC_MSG_CHECKING([for KexiDB headers])
  kexidb_incdirs="$kde_prefix/include $kde_prefix/include/tde /usr/include /usr/include/tde /usr/local/include /opt/kde/include"
  AC_FIND_FILE("kexidb/driver.h", $kexidb_incdirs, kexidb_incdir)
  if test ! -r $kexidb_incdir/kexidb/driver.h; then
    AC_MSG_RESULT([Could not find the required KexiDB HEADER files.])
  else
    AC_MSG_RESULT([$kexidb_incdir])
    KEXIDB_INC=$kexidb_incdir
  fi
else
  KEXIDB_INC=$ac_kexidb_incdir
fi

# Find lib dir
if test "$ac_kexidb_libdir" = "" ; then
  AC_MSG_CHECKING([for KexiDB libraries])
  kexidb_libdirs="$kde_prefix/lib /usr/lib /usr/local/lib /opt/kde/lib"
  AC_FIND_FILE(libkexidb.so, $kexidb_libdirs, kexidb_libdir)
  if test ! -r $kexidb_libdir/libkexidb.so ; then
    AC_MSG_RESULT([Could not find the required KexiDB LIBRARY files.])
  else
    AC_MSG_RESULT([$kexidb_libdir])
    KEXIDB_LIB=$kexidb_libdir
  fi
else
  KEXIDB_LIB=$ac_kexidb_libdir
fi

AC_SUBST(KEXIDB_INC)
AC_SUBST(KEXIDB_LIB)
dnl =======================================================
dnl FILE: ./keximdb/src/mdbtools/configure.in.in
dnl =======================================================

AC_CHECK_HEADERS(fcntl.h wordexp.h)

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

dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
dnl those with the standalone portable GNU libiconv installed).

  AC_ARG_WITH([libiconv-prefix],
AC_HELP_STRING([--with-libiconv-prefix=DIR], [search for libiconv in DIR/include and DIR/lib]), [
    for dir in `echo "$withval" | tr : ' '`; do
      if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
      if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi
    done
   ])

  AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
    am_cv_func_iconv="no, consider installing GNU libiconv"
    am_cv_lib_iconv=no
    AC_TRY_LINK([#include <stdlib.h>
#include <iconv.h>],
      [iconv_t cd = iconv_open("","");
       iconv(cd,NULL,NULL,NULL,NULL);
       iconv_close(cd);],
      am_cv_func_iconv=yes)
    if test "$am_cv_func_iconv" != yes; then
      am_save_LIBS="$LIBS"
      LIBS="$LIBS -liconv"
      AC_TRY_LINK([#include <stdlib.h>
#include <iconv.h>],
        [iconv_t cd = iconv_open("","");
         iconv(cd,NULL,NULL,NULL,NULL);
         iconv_close(cd);],
        am_cv_lib_iconv=yes
        am_cv_func_iconv=yes)
      LIBS="$am_save_LIBS"
    fi
  ])
  if test "$am_cv_func_iconv" = yes; then
    AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
    AC_MSG_CHECKING([for iconv declaration])
    AC_CACHE_VAL(am_cv_proto_iconv, [
      AC_TRY_COMPILE([
#include <stdlib.h>
#include <iconv.h>
extern
#ifdef __cplusplus
"C"
#endif
#if defined(__STDC__) || defined(__cplusplus)
size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
#else
size_t iconv();
#endif
], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
      am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
    am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
    AC_MSG_RESULT([$]{ac_t:-
         }[$]am_cv_proto_iconv)
    AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
      [Define as const if the declaration of iconv() needs const.])
  fi
  LIBICONV=
  if test "$am_cv_lib_iconv" = yes; then
    LIBICONV="-liconv"
  fi
  AC_SUBST(LIBICONV)
KDE_CREATE_SUBDIRSLIST
AM_CONDITIONAL(keximdb_SUBDIR_included, test "x$keximdb_SUBDIR_included" = xyes)
AC_CONFIG_FILES([ Makefile ])
AC_CONFIG_FILES([ keximdb/Makefile ])
AC_CONFIG_FILES([ keximdb/src/Makefile ])
AC_CONFIG_FILES([ keximdb/src/keximdb/Makefile ])
AC_CONFIG_FILES([ keximdb/src/mdbtools/Makefile ])
AC_CONFIG_FILES([ keximdb/src/mdbtools/libmdb/Makefile ])
AC_OUTPUT
if test -z "$KEXIDB_INC" -o -z "$KEXIDB_LIB"; then

  if test -z "$KEXIDB_INC"; then
    echo "  + The KexiDB headers were not found"
  fi

  if test -z "$KEXIDB_LIB"; then
    echo "  + The KexiDB libraries were not found"
  fi

  echo "     Required KexiDB development files were not found."
  echo "     If these are installed, you can use the --with-kexidb-includes"
  echo "     and --with-kexidb-libraries configure options."
  echo "     If not, these may be available as a package for your"
  echo "     distribution, or you can install them by installing Kexi"
  echo "     from source"

  all_tests=bad
else
  echo "KexiDB includes: $KEXIDB_INC"
  echo "KexiDB libraries: $KEXIDB_LIB"
fi

# Check if KDE_SET_PREFIX was called, and --prefix was passed to configure
if test -n "$kde_libs_prefix" -a -n "$given_prefix"; then
  # And if so, warn when they don't match
  if test "$kde_libs_prefix" != "$given_prefix"; then
    # And if kde doesn't know about the prefix yet
    echo ":"`tde-config --path exe`":" | grep ":$given_prefix/bin/:" 2>&1 >/dev/null
    if test $? -ne 0; then
      echo ""
      echo "Warning: you chose to install this package in $given_prefix,"
      echo "but KDE was found in $kde_libs_prefix."
      echo "For this to work, you will need to tell KDE about the new prefix, by ensuring"
      echo "that TDEDIRS contains it, e.g. export TDEDIRS=$given_prefix:$kde_libs_prefix"
      echo "Then restart KDE."
      echo ""
    fi
  fi
fi

if test x$GXX = "xyes" -a x$kde_have_gcc_visibility = "xyes" -a x$kde_cv_val_qt_gcc_visibility_patched = "xno"; then
  echo ""
  echo "Your GCC supports symbol visibility, but the patch for Qt supporting visibility"
  echo "was not included. Therefore, GCC symbol visibility support remains disabled."
  echo ""
  echo "For better performance, consider including the Qt visibility supporting patch"
  echo "located at:"
  echo ""
  echo "http://bugs.kde.org/show_bug.cgi?id=109386"
  echo ""
  echo "and recompile all of Qt and KDE. Note, this is entirely optional and"
  echo "everything will continue to work just fine without it."
  echo ""
fi

if test "$all_tests" = "bad"; then
  if test ! "$cache_file" = "/dev/null"; then
    echo ""
    echo "Please remove the file $cache_file after changing your setup"
    echo "so that configure will find the changes next time."
    echo ""
  fi
else
  echo ""
  echo "Good - your configure finished. Start make now"
  echo ""
fi