1 # Process this file with autoconf to produce a configure script.
3 AC_CONFIG_SRCDIR([src/gmk_sym.c])
9 echo Configuring $PACKAGE version $DOTTED_VERSION.$DATE_VERSION
12 AM_INIT_AUTOMAKE($PACKAGE, $DOTTED_VERSION, no-define)
13 AM_CONFIG_HEADER([config.h])
15 #########################################################################
16 # Command line flags start
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
24 # Command line flags end
25 #########################################################################
27 # Checks for programs.
30 AM_CONDITIONAL(CCISGCC, test "$GCC" = "yes")
35 AC_PATH_PROG(PERL, perl, [notfound])
36 AM_CONDITIONAL(MISSING_PERL, test x$PERL = xnotfound)
38 ##############################################################3
42 AC_MSG_CHECKING([For a working C99 __func__])
43 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
44 [[const char *foo = __func__;]])],
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__])
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 #########################################################################
68 # Misc win32 / mingw checks and variables start
71 # Figure out if we are building on win32 and what environment.
73 *mingw32* ) echo "Configuring for mingw"; MINGW=yes ;;
76 if ! test "$MINGW" = "no" -o "$MINGW"x = x; then
77 MINGW_CFLAGS="-mms-bitfields -mwindows"
86 # Misc win32 / mingw checks and variables end
87 #########################################################################
89 ############################################################################
90 # Check for guile start
92 # Check for pkg-config
93 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
94 if test $PKG_CONFIG = no; then
95 AC_MSG_ERROR([Cannot find pkg-config, make sure it is installed and in your PATH])
98 PKG_CHECK_MODULES(GUILE, guile-2.0, GUILE_PC="yes", no_GUILE_PC="yes")
100 if test "$GUILE_PC" = "yes"
102 GUILE_VERSION=`$PKG_CONFIG guile-2.0 --modversion`
104 # Find about the installed guile
106 GUILE_VERSION=`$GUILE_CONFIG info guileversion`
109 # Check Guile version
112 guile_need_version="$guile_need_major[].$guile_need_minor.0"
114 AC_MSG_CHECKING([Guile version >= $guile_need_version])
116 guile_major=`echo "$GUILE_VERSION" | sed 's/\([[^.]][[^.]]*\).*/\1/'`
117 guile_minor=`echo "$GUILE_VERSION" | sed 's/[[^.]][[^.]]*.\([[^.]][[^.]]*\).*/\1/'`
118 AC_MSG_RESULT($GUILE_VERSION)
120 if test "$guile_need_major" -gt "$guile_major" \
121 || (test "$guile_need_major" -eq "$guile_major" \
122 && test "$guile_need_minor" -gt "$guile_minor"); then
123 AC_MSG_ERROR([Guile version >= $guile_need_version is required.])
126 # Guile 1.6 compatability
128 CFLAGS_temp_save="$CFLAGS"
129 CFLAGS="$CFLAGS $GUILE_CFLAGS"
130 AC_CHECK_DECLS([scm_is_string, scm_is_integer, scm_to_int,
131 scm_from_int, scm_is_true, scm_is_false,
132 scm_from_locale_string, scm_to_locale_string],,,
133 [#include <libguile.h>])
134 CFLAGS="$CFLAGS_temp_save"
136 AH_VERBATIM(SCM_IS_STRING, [#if !HAVE_DECL_SCM_IS_STRING
137 # define scm_is_string(x) SCM_STRINGP(x)
139 AH_VERBATIM(SCM_IS_INTEGER, [#if !HAVE_DECL_SCM_IS_INTEGER
140 # define scm_is_integer(x) SCM_INUMP(x)
142 AH_VERBATIM(SCM_TO_INT, [#if !HAVE_DECL_SCM_TO_INT
143 # define scm_to_int(x) SCM_INUM(x)
145 AH_VERBATIM(SCM_FROM_INT, [#if !HAVE_DECL_SCM_FROM_INT
146 # define scm_from_int(x) SCM_MAKINUM(x)
148 AH_VERBATIM(SCM_IS_TRUE, [#if !HAVE_DECL_SCM_IS_TRUE
149 # define scm_is_true(x) SCM_NFALSEP(x)
151 AH_VERBATIM(SCM_IS_FALSE, [#if !HAVE_DECL_SCM_IS_FALSE
152 # define scm_is_false(x) SCM_FALSEP(x)
154 AH_VERBATIM(SCM_FROM_LOCALE_STRING, [#if !HAVE_DECL_SCM_FROM_LOCALE_STRING
155 # define scm_from_locale_string(x) scm_makfrom0str(x)
157 AH_VERBATIM(SCM_TO_LOCALE_STRING, [#if !HAVE_DECL_SCM_TO_LOCALE_STRING
158 # define scm_to_locale_string(x) strdup(SCM_STRING_CHARS(x))
162 # Check for guile end
163 ############################################################################
165 ############################################################################
166 # Check for mics things start
168 # Checking for rint in math library
169 AC_CHECK_LIB(m, rint, AC_DEFINE(HAS_RINT, 1, [If your math library has rint in it, define this]), no_RINT="yes")
171 # Checking for dynamic lib
172 AC_CHECK_LIB(dl, dlopen, DL_LIB="-ldl", DL_LIB="")
174 # Check for mics things start
175 ############################################################################
177 ############################################################################
178 # Check for libgeda start
180 PKG_CHECK_MODULES(LIBGEDA, libgeda >= $DATE_VERSION, LIBGEDA="yes",
183 if test "$LIBGEDA" = "yes"
185 LIBGEDA_VERSION=`$PKG_CONFIG libgeda --modversion`
187 AC_MSG_ERROR([libgeda detection error: $LIBGEDA_PKG_ERRORS])
191 # Check for libgeda end
192 ############################################################################
194 ############################################################################
195 # Check for gtk+ 2.4 start
198 PKG_CHECK_MODULES(GTK24, gtk+-2.0 >= 2.4.0, GTK24="yes", no_GTK24="yes")
200 # This next bit of code figures out what gtk we need to use.
201 if test "$GTK24" = "yes"
204 AC_DEFINE(HAS_GTK24, 1, [If gtk+ 2.4.x has been installed, define this])
205 GTK_CFLAGS=$GTK24_CFLAGS
207 GTK_VERSION=`$PKG_CONFIG gtk+-2.0 --modversion`
210 PKG_CHECK_MODULES(GLIB24, glib-2.0 >= 2.4.0, GLIB24="yes", no_GLIB24="yes")
211 if test "$GLIB24" != "yes"
213 AC_MSG_ERROR([Cannot find glib 2.4.x, install it and rerun ./configure.])
215 GLIB_CFLAGS=$GLIB24_CFLAGS
216 GLIB_LIBS=$GLIB24_LIBS
217 GLIB_VERSION=`$PKG_CONFIG glib-2.0 --modversion`
223 if test "$GTK_VERSION" = ""
225 AC_MSG_ERROR([Cannot find gtk+ 2.4.x or later, please install gtk+.])
229 # Check for gtk+ 2.4 end
230 ############################################################################
232 ############################################################################
233 # Check for glib 2.4 start
236 # Check for pkg-config
237 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
238 if test $PKG_CONFIG = no; then
239 AC_MSG_ERROR([Cannot find pkg-config, make sure it is installed and in your PATH])
242 # Search for glib 2.4.x first (only if we are not forcing the glib to 1.2)
243 if test "$opt_gtkver" != "1.2"
245 PKG_CHECK_MODULES(GLIB24, glib-2.0 >= 2.4.0, GLIB24="yes", no_GLIB24="yes")
248 # This next bit of code figures out what glib we need to use.
249 if test "$GLIB24" = "yes" -a "$opt_gtkver" != "1.2"
251 GLIB_CFLAGS=$GLIB24_CFLAGS
252 GLIB_LIBS=$GLIB24_LIBS
253 GLIB_VERSION=`$PKG_CONFIG glib-2.0 --modversion`
258 if test "$GLIB_VERSION" = ""
260 AC_MSG_ERROR([Cannot find glib 2.4.x, install one of them.])
264 # Check for glib 2.4 end
265 ############################################################################
267 #########################################################################
268 # Checks for header files start
273 AC_CHECK_HEADERS(unistd.h string.h stdlib.h \
274 stdarg.h assert.h fcntl.h errno.h \
277 # Checks for typedefs, structures, and compiler characteristics.
280 # Checks for library functions.
282 AC_CHECK_FUNCS(strstr snprintf getopt_long)
283 AC_CHECK_FUNCS(strcasecmp strncasecmp stricmp strnicmp)
285 AC_MSG_CHECKING([for optarg in unistd.h])
287 [#include <unistd.h>],
288 [ char *string = optarg; int i = optind; ],
291 AC_MSG_RESULT($optarg_found)
293 if test $optarg_found = yes; then
294 AC_DEFINE(OPTARG_IN_UNISTD, 1, [Define if you have optarg in unistd.h])
298 # Checks for header files start
299 #########################################################################
301 #########################################################################
304 # ------------- dmalloc -------------------
307 AC_MSG_CHECKING([if dmalloc debugging should be enabled])
308 AC_ARG_ENABLE([dmalloc],
309 [ --enable-dmalloc Compile and link with dmalloc for malloc debugging [[default=no]]],
311 if test "X$enable_dmalloc" != "Xno" ; then
313 AC_CHECK_HEADER(dmalloc.h,,
314 AC_ERROR([You have requested dmalloc debugging but dmalloc.h could not be found]))
315 AC_CHECK_LIB(dmalloc,main,,
316 AC_ERROR([You have requested dmalloc debugging but -ldmalloc could not be found]))
317 DMALLOC_LIBS="-ldmalloc"
329 # ------------- ElectricFence -------------------
330 dnl ElectricFence checks
332 AC_MSG_CHECKING([if ElectricFence debugging should be enabled])
333 AC_ARG_ENABLE([efence],
334 [ --enable-efence Link with ElectricFence for malloc debugging [[default=no]]],
336 if test "X$enable_efence" != "Xno" ; then
338 if test "X$with_dmalloc" = "Xyes" ; then
339 AC_ERROR([You have requested both dmalloc and Electric Fence, however only 1 is allowed.])
341 AC_CHECK_LIB(efence,main,,
342 AC_ERROR([You have requested ElectricFence debugging but -lefence could not be found]))
353 #########################################################################
355 #########################################################################
357 # Change default location for pcb's newlib library directory
361 AC_MSG_CHECKING([For the default pcb installation data directory])
362 AC_ARG_WITH(pcb-datadir,
363 [ --with-pcb-datadir=path
364 Change the default location for an installed pcb. This is used
365 to set the default search path for pcb newlib libraries.
366 [[default=${datadir}]]],
367 [PCBDATADIR=$withval],
368 [PCBDATADIR="${datadir}"]
370 AC_MSG_RESULT([${PCBDATADIR}])
371 CPPFLAGS="$CPPFLAGS -DPCBDATADIR=\\\"${PCBDATADIR}\\\""
373 AC_MSG_CHECKING([For the default pcb newlib search path])
374 AC_ARG_WITH(pcb-newlib-path,
375 [ --with-pcb-newlib-path=path
376 Change the default search path for PCB newlib libraries
377 [[default=${datadir}/pcb/pcblib-newlib:${datadir}/pcb/newlib]]],
378 [PCBLIBPATH=$withval],
379 [PCBLIBPATH="${PCBDATADIR}/pcb/pcblib-newlib:${PCBDATADIR}/pcb/newlib"]
381 AC_MSG_RESULT([${PCBLIBPATH}])
382 CPPFLAGS="$CPPFLAGS -DPCBLIBPATH=\\\"${PCBLIBPATH}\\\""
385 #########################################################################
387 #########################################################################
388 # Check for groff start
392 AC_PATH_PROG(GROFF, groff, no, ${PATH})
393 if test $GROFF = "no"; then
394 echo "Cannot find groff, some documentation will not be created."
398 # Check for groff end
399 #########################################################################
401 #########################################################################
402 # gEDA/gaf specify setup start
406 GEDADATADIR=$datadir/$DATADIR
408 if eval "test x$opt_rcdir = x"; then
409 # path not was specified with --with-rcdir
410 AC_DEFINE_UNQUOTED(GEDARCDIR, "none", [gEDA/gaf's rc directory])
411 GEDARCDIR=$GEDADATADIR
413 # path WAS specified with --with-rcdir
414 AC_DEFINE_UNQUOTED(GEDARCDIR, "$opt_rcdir", [gEDA/gaf's rc directory])
415 GEDARCDIR="$opt_rcdir"
418 # Expand the prefix variable
419 # I don't like the way this is done, but it works (I hope).
420 if eval "test x$prefix = xNONE"; then
421 dprefix=$ac_default_prefix
426 gedatopdir=$dprefix/share/$DATADIR
427 expandgedadatadir=`echo $gedatopdir`
429 gedadocdir=$dprefix/share/doc/geda-doc
430 # --with-docdir : tells where to store documentation if not default
432 [ --with-docdir Where to store documentation if not default.],
434 expandgedadocdir=`echo $gedadocdir`
435 GEDADOCDIR=$expandgedadocdir
437 # this has to be expanded ( no ${prefix} ) --
438 AC_DEFINE_UNQUOTED(GEDADATADIR, "$gedatopdir", [gEDA/gaf's data directory])
439 AC_DEFINE_UNQUOTED(DATE_VERSION, "$DATE_VERSION", [Currently running date version of gEDA/gaf])
440 AC_DEFINE_UNQUOTED(DOTTED_VERSION, "$DOTTED_VERSION", [Currently running dotted version of gEDA/gaf])
441 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this program's package])
444 # gEDA/gaf specify things which need to setup
445 #########################################################################
447 # Finally create the final CFLAGS and LDFLAGS for use in the makefiles
448 GSCHLAS_CFLAGS="$LIBGEDA_CFLAGS"
449 GSCHLAS_LDFLAGS="$LIBGEDA_LIBS $GTK_LIBS"
450 GMK_SYM_CFLASG="$MINGW_CFLAGS"
451 SMASH_MEGAFILE_CFLAGS="$MINGW_CFLAGS"
452 CONVERT_SYM_CFLAGS="$LIBGEDA_CFLAGS"
453 SARLACC_SCHEM_CFLAGS="$LIBGEDA_CFLAGS"
454 OLIB_CFLAGS="$MINGW_CFLAGS"
455 GSCH2PCB_CFLAGS="$GLIB_CFLAGS $MINGW_CFLAGS"
456 GSCH2PCB_LDFLAGS="$GLIB_LIBS"
457 GRENUM_CFLAGS="$LIBGEDA_CFLAGS"
458 GRENUM_LDFLAGS="$GLIB_LIBS"
460 # Makefile.in variable substitution
461 AC_SUBST(DATE_VERSION)
462 AC_SUBST(DOTTED_VERSION)
463 AC_SUBST(GSCHLAS_CFLAGS)
464 AC_SUBST(GSCHLAS_LDFLAGS)
465 AC_SUBST(GMK_SYM_CFLAGS)
466 AC_SUBST(SMASH_MEGAFILE_CFLAGS)
467 AC_SUBST(CONVERT_SYM_CFLAGS)
468 AC_SUBST(SARLACC_SCHEM_CFLAGS)
469 AC_SUBST(OLIB_CFLAGS)
470 AC_SUBST(GSCH2PCB_CFLAGS)
471 AC_SUBST(GSCH2PCB_LDFLAGS)
472 AC_SUBST(GRENUM_CFLAGS)
473 AC_SUBST(GRENUM_LDFLAGS)
475 AC_SUBST(GEDADATADIR)
478 # Create all the necessary derived files
479 AC_CONFIG_FILES([Makefile
481 examples/gmk_sym/Makefile
482 examples/tragesym/Makefile
483 examples/gsch2pcb/Makefile
494 tests/refdes_renum/Makefile
495 tests/refdes_renum/inputs/Makefile
496 tests/refdes_renum/outputs/Makefile
498 tests/gxyrs/inputs/Makefile
499 tests/gxyrs/outputs/Makefile
504 expandedGEDADATADIR=`eval "echo $GEDADATADIR"`
505 expandedGEDARCDIR=`eval "echo $GEDARCDIR"`
506 expandedGEDADOCDIR=`eval "echo $GEDADOCDIR"`
507 expandedPCBLIBPATH=`eval "echo $PCBLIBPATH"`
510 ** Configuration summary for $PACKAGE $DOTTED_VERSION.$DATE_VERSION:
512 GTK+ library version: $GTK_VERSION
513 GLIB library version: $GLIB_VERSION
514 libgeda library version: $LIBGEDA_VERSION
516 data directory: $expandedGEDADATADIR
517 rc directory: $expandedGEDARCDIR
518 documentation directory: $expandedGEDADOCDIR
519 default pcb newlib path: $expandedPCBLIBPATH
520 dmalloc debugging: $with_dmalloc
521 Electric Fence debugging: $with_efence