gschem: Add name completion to attribute edit dialog
[geda-gaf/whiteaudio.git] / utils / configure.ac
blob97910e3f8d9100d1473964e708c86d56be1efce5
1 # Process this file with autoconf to produce a configure script.
2 AC_INIT
3 AC_CONFIG_SRCDIR([src/gmk_sym.c])
4 AC_PREREQ(2.54)
6 PACKAGE=geda-utils
7 DOTTED_VERSION=1.5.2
8 DATE_VERSION=20090328
9 echo Configuring $PACKAGE version $DOTTED_VERSION.$DATE_VERSION
11 # Initialize automake 
12 AM_INIT_AUTOMAKE($PACKAGE, $DOTTED_VERSION, no-define)
13 AC_CONFIG_HEADER([config.h])
15 #########################################################################
16 # Command line flags start
17
18 # Change default location for rc files
19 AC_ARG_WITH(rcdir, [  --with-rcdir=path       Change where the system-*rc files are installed], [opt_rcdir=$withval])
21 # --with-docdir : tells where to store documentation if not default
22 # defined below 
23
24 # Command line flags end
25 #########################################################################
27 # Checks for programs.
28 AC_PROG_CC
29 AM_PROG_CC_C_O
30 AM_CONDITIONAL(CCISGCC, test "$GCC" = "yes")
31 AC_PROG_CPP
32 AC_PROG_MAKE_SET
33 AM_PROG_LEX
35 AC_PATH_PROG(PERL, perl, [notfound])
36 AM_CONDITIONAL(MISSING_PERL, test x$PERL = xnotfound)
38 ##############################################################3
39 # Test for __func__
42 AC_MSG_CHECKING([For a working C99 __func__])
43 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
44         [[const char *foo = __func__;]])],
45    [ac_cv_cpp_func=yes],
46    [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
47                 [[const char *foo = __FUNCTION__;]])],
48                 [ac_cv_cpp_func=__FUNCTION__],
49                 [ac_cv_cpp_func="\"no\""])]
52 if test "X$ac_cv_cpp_func" = "X__FUNCTION__"; then
53         AC_MSG_RESULT([__FUNCTION__])
54 elif test "x$ac_cv_cpp_func" = "xyes" ; then
55         AC_MSG_RESULT([__func__])
56 else
57         AC_MSG_RESULT([no])
59 if test "X$ac_cv_cpp_func" != "Xyes" ; then
60         AC_DEFINE_UNQUOTED([__func__], [$ac_cv_cpp_func], [Define to be a __func__ replacement])
64 ##############################################################3
66 #########################################################################
67
68 # Misc win32 / mingw checks and variables start
69 AC_CANONICAL_HOST
71 # Figure out if we are building on win32 and what environment.
72 case $host_os in
73   *mingw32* ) echo "Configuring for mingw"; MINGW=yes ;;
74 esac
76 if ! test "$MINGW" = "no" -o "$MINGW"x = x; then
77    MINGW="yes"
78 else
79    # Unix host
80    MINGW="no"
83
84 # Misc win32 / mingw checks and variables end
85 #########################################################################
87 ############################################################################
88 # Check for guile start
90 # Check for pkg-config
91 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
92 if test $PKG_CONFIG = no; then
93    AC_MSG_ERROR([Cannot find pkg-config, make sure it is installed and in your PATH])
96 PKG_CHECK_MODULES(GUILE, [guile-1.8], GUILE_PC="yes", no_GUILE_PC="yes")
98 if test "$GUILE_PC" = "yes" 
99 then
101    GUILE_VERSION=`$PKG_CONFIG guile-1.8 --modversion`
103 else
105   # Find about the installed guile
106   GUILE_FLAGS
107   GUILE_VERSION=`$GUILE_CONFIG info guileversion`
111 # Check Guile version
112 guile_need_major=1
113 guile_need_minor=8
114 guile_need_version="$guile_need_major[].$guile_need_minor.0"
116 AC_MSG_CHECKING([Guile version >= $guile_need_version])
118 guile_major=`echo "$GUILE_VERSION" | sed 's/\([[^.]][[^.]]*\).*/\1/'`
119 guile_minor=`echo "$GUILE_VERSION" | sed 's/[[^.]][[^.]]*.\([[^.]][[^.]]*\).*/\1/'`
120 AC_MSG_RESULT($GUILE_VERSION)
122 if test "$guile_need_major" -gt "$guile_major" \
123    || (test "$guile_need_major" -eq "$guile_major" \
124        && test "$guile_need_minor" -gt "$guile_minor"); then
125   AC_MSG_ERROR([Guile version >= $guile_need_version is required.])
129 # Check for guile end
130 ############################################################################
132 ############################################################################
133 # Check for mics things start
135 # Checking for rint in math library
136 AC_CHECK_LIB(m, rint, AC_DEFINE(HAS_RINT, 1, [If your math library has rint in it, define this]), no_RINT="yes")
138 # Checking for dynamic lib
139 AC_CHECK_LIB(dl, dlopen, DL_LIB="-ldl", DL_LIB="")
141 # Check for mics things start
142 ############################################################################
144 ############################################################################
145 # Check for libgeda start
147 PKG_CHECK_MODULES(LIBGEDA, [libgeda >= $DATE_VERSION], LIBGEDA="yes", 
148                   no_LIBGEDA="yes")
150 if test "$LIBGEDA" = "yes" 
151 then
152    LIBGEDA_VERSION=`$PKG_CONFIG libgeda --modversion`
153 else
154    AC_MSG_ERROR([libgeda detection error: $LIBGEDA_PKG_ERRORS])
158 # Check for libgeda end
159 ############################################################################
161 ############################################################################
162 # Check for glib start
165 PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.12.0], GLIB="yes", no_GLIB="yes")
167 # This next bit of code figures out what glib we need to use.
168 if test "$GLIB" != "yes"
169 then
170    AC_MSG_ERROR([Cannot find glib 2.12.0 or later, please install it and rerun ./configure.])
172 GLIB_VERSION=`$PKG_CONFIG glib-2.0 --modversion`
175 # Check for glib end
176 ############################################################################
178 #########################################################################
179 # Checks for header files start
181 AC_HEADER_STDC
182 AC_HEADER_SYS_WAIT
183 AC_HEADER_DIRENT
184 AC_CHECK_HEADERS(unistd.h string.h stdlib.h \
185                  stdarg.h assert.h fcntl.h errno.h \
186                  getopt.h)
188 # Checks for typedefs, structures, and compiler characteristics.
189 AC_C_CONST
191 # Checks for library functions.
192 AC_TYPE_SIGNAL
193 AC_CHECK_FUNCS(strstr snprintf getopt_long)
194 AC_CHECK_FUNCS(strcasecmp strncasecmp stricmp strnicmp)
196 AC_MSG_CHECKING([for optarg in unistd.h])
197 AC_TRY_COMPILE(
198 [#include <unistd.h>],
199 [ char *string = optarg; int i = optind; ],
200 optarg_found=yes,
201 optarg_found=no)
202 AC_MSG_RESULT($optarg_found)
204 if test $optarg_found = yes; then
205     AC_DEFINE(OPTARG_IN_UNISTD, 1, [Define if you have optarg in unistd.h])
209 # Checks for header files start
210 #########################################################################
212 #########################################################################
215 # ------------- dmalloc -------------------
216 dnl dmalloc checks
217 with_dmalloc="no"
218 AC_MSG_CHECKING([if dmalloc debugging should be enabled])
219 AC_ARG_ENABLE([dmalloc],
220 [  --enable-dmalloc        Compile and link with dmalloc for malloc debugging [[default=no]]],
222 if test "X$enable_dmalloc" != "Xno" ; then
223         AC_MSG_RESULT([yes])
224         AC_CHECK_HEADER(dmalloc.h,,
225                 AC_ERROR([You have requested dmalloc debugging but dmalloc.h could not be found]))
226         AC_CHECK_LIB(dmalloc,main,,
227                 AC_ERROR([You have requested dmalloc debugging but -ldmalloc could not be found]))
228         DMALLOC_LIBS="-ldmalloc"
229         with_dmalloc="yes"
230 else
231         AC_MSG_RESULT([no])
232         DMALLOC_LIBS=""
236         AC_MSG_RESULT([no])
237         DMALLOC_LIBS=""
240 # ------------- ElectricFence -------------------
241 dnl ElectricFence checks
242 with_efence="no"
243 AC_MSG_CHECKING([if ElectricFence debugging should be enabled])
244 AC_ARG_ENABLE([efence],
245 [  --enable-efence         Link with ElectricFence for malloc debugging [[default=no]]],
247 if test "X$enable_efence" != "Xno" ; then
248         AC_MSG_RESULT([yes])
249         if test "X$with_dmalloc" = "Xyes" ; then
250                 AC_ERROR([You have requested both dmalloc and Electric Fence, however only 1 is allowed.])
251         fi
252         AC_CHECK_LIB(efence,main,,
253                 AC_ERROR([You have requested ElectricFence debugging but -lefence could not be found]))
254         with_efence="yes"
255 else
256         AC_MSG_RESULT([no])
260 AC_MSG_RESULT([no])
264 #########################################################################
266 #########################################################################
268 # Change default location for pcb's newlib library directory
270 # Used by gsch2pcb
272 AC_MSG_CHECKING([For the default pcb installation data directory])
273 AC_ARG_WITH(pcb-datadir,
274         [  --with-pcb-datadir=path
275                           Change the default location for an installed pcb.  This is used
276                           to set the default search path for pcb newlib libraries.
277                           [[default=${datadir}]]],
278         [PCBDATADIR=$withval],
279         [PCBDATADIR="${datadir}"]
281 AC_MSG_RESULT([${PCBDATADIR}])
282 CPPFLAGS="$CPPFLAGS -DPCBDATADIR=\\\"${PCBDATADIR}\\\""
284 AC_MSG_CHECKING([For the default pcb newlib search path])
285 AC_ARG_WITH(pcb-newlib-path,
286         [  --with-pcb-newlib-path=path
287                           Change the default search path for PCB newlib libraries
288                           [[default=${datadir}/pcb/pcblib-newlib:${datadir}/pcb/newlib]]],
289         [PCBLIBPATH=$withval],
290         [PCBLIBPATH="${PCBDATADIR}/pcb/pcblib-newlib:${PCBDATADIR}/pcb/newlib"]
292 AC_MSG_RESULT([${PCBLIBPATH}])
293 CPPFLAGS="$CPPFLAGS -DPCBLIBPATH=\\\"${PCBLIBPATH}\\\""
296 #########################################################################
298 #########################################################################
299 # Check for groff start
302 # search for groff
303 AC_PATH_PROG(GROFF, groff, no, ${PATH})
304 if test $GROFF = "no"; then
305         echo "Cannot find groff, some documentation will not be created."
309 # Check for groff end
310 #########################################################################
312 #########################################################################
313 # gEDA/gaf specify setup start
316 DATADIR=gEDA
317 GEDADATADIR=$datadir/$DATADIR
319 if eval "test x$opt_rcdir = x"; then
320         # path not was specified with --with-rcdir
321         AC_DEFINE_UNQUOTED(GEDARCDIR, "none", [gEDA/gaf's rc directory])
322         GEDARCDIR=$GEDADATADIR
323 else
324         # path WAS specified with --with-rcdir
325         AC_DEFINE_UNQUOTED(GEDARCDIR, "$opt_rcdir", [gEDA/gaf's rc directory])
326         GEDARCDIR="$opt_rcdir"
329 # Expand the prefix variable
330 # I don't like the way this is done, but it works (I hope).
331 if eval "test x$prefix = xNONE"; then
332  dprefix=$ac_default_prefix
333 else
334  dprefix=$prefix
337 gedatopdir=$dprefix/share/$DATADIR
338 expandgedadatadir=`echo $gedatopdir`
340 gedadocdir=$dprefix/share/doc/geda-doc
341 # --with-docdir : tells where to store documentation if not default
342 AC_ARG_WITH(docdir,
343     [  --with-docdir      Where to store documentation if not default.],
344         gedadocdir=$withval)
345 expandgedadocdir=`echo $gedadocdir`
346 GEDADOCDIR=$expandgedadocdir
348 # this has to be expanded ( no ${prefix} ) --
349 AC_DEFINE_UNQUOTED(GEDADATADIR, "$gedatopdir", [gEDA/gaf's data directory])
350 AC_DEFINE_UNQUOTED(DATE_VERSION, "$DATE_VERSION", [Currently running date version of gEDA/gaf])
351 AC_DEFINE_UNQUOTED(DOTTED_VERSION, "$DOTTED_VERSION", [Currently running dotted version of gEDA/gaf])
352 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this program's package])
355 # gEDA/gaf specify things which need to setup
356 #########################################################################
358 # Finally create the final CFLAGS and LDFLAGS for use in the makefiles
359 GSCHLAS_CFLAGS="$GLIB_CFLAGS $LIBGEDA_CFLAGS $GUILE_CFLAGS"
360 GSCHLAS_LDFLAGS="$GLIB_LIBS $LIBGEDA_LIBS $GUILE_LIBS"
361 CONVERT_SYM_CFLAGS="$LIBGEDA_CFLAGS"
362 SARLACC_SCHEM_CFLAGS="$GLIB_CFLAGS $LIBGEDA_CFLAGS"
363 SARLACC_SCHEM_LIBS="$GLIB_LIBS $LIBGEDA_CFLAGS"
364 GMK_SYM_CFLASG=""
365 SMASH_MEGAFILE_CFLAGS=""
366 OLIB_CFLAGS=""
367 GSCH2PCB_CFLAGS="$GLIB_CFLAGS"
368 GSCH2PCB_LDFLAGS="$GLIB_LIBS"
370 # Makefile.in variable substitution
371 AC_SUBST(DATE_VERSION)
372 AC_SUBST(DOTTED_VERSION)
373 AC_SUBST(GSCHLAS_CFLAGS)
374 AC_SUBST(GSCHLAS_LDFLAGS)
375 AC_SUBST(CONVERT_SYM_CFLAGS)
376 AC_SUBST(SARLACC_SCHEM_CFLAGS)
377 AC_SUBST(SARLACC_SCHEM_LDFLAGS)
378 AC_SUBST(GMK_SYM_CFLAGS)
379 AC_SUBST(GMK_SYM_LDFLAGS)
380 AC_SUBST(GSCH2PCB_CFLAGS)
381 AC_SUBST(GSCH2PCB_LDFLAGS)
382 AC_SUBST(GEDARCDIR)
383 AC_SUBST(GEDADATADIR)
384 AC_SUBST(GEDADOCDIR)
386 # Create all the necessary derived files
387 AC_CONFIG_FILES([Makefile 
388                  examples/Makefile 
389                  examples/gmk_sym/Makefile 
390                  examples/tragesym/Makefile 
391                  examples/gsch2pcb/Makefile 
392                  gxyrs/Makefile
393                  include/Makefile 
394                  scripts/Makefile 
395                  docs/Makefile 
396                  man/Makefile 
397                  lib/Makefile 
398                  lib/system-gschlasrc 
399                  gschlas/Makefile 
400                  src/Makefile
401                  tests/Makefile
402                  tests/refdes_renum/Makefile
403                  tests/refdes_renum/inputs/Makefile
404                  tests/refdes_renum/outputs/Makefile
405                  tests/gxyrs/Makefile
406                  tests/gxyrs/inputs/Makefile
407                  tests/gxyrs/outputs/Makefile
410 AC_OUTPUT
412 expandedGEDADATADIR=`eval "echo $GEDADATADIR"`
413 expandedGEDARCDIR=`eval "echo $GEDARCDIR"`
414 expandedGEDADOCDIR=`eval "echo $GEDADOCDIR"`
415 expandedPCBLIBPATH=`eval "echo $PCBLIBPATH"`
417 AC_MSG_RESULT([
418 ** Configuration summary for $PACKAGE $DOTTED_VERSION.$DATE_VERSION:
420    GLIB library version:             $GLIB_VERSION
421    libgeda library version:          $LIBGEDA_VERSION
422    mingw build:                      $MINGW
423    data directory:                   $expandedGEDADATADIR
424    rc directory:                     $expandedGEDARCDIR
425    documentation directory:          $expandedGEDADOCDIR
426    default pcb newlib path:          $expandedPCBLIBPATH
427    dmalloc debugging:                $with_dmalloc
428    Electric Fence debugging:         $with_efence