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"
78 MINGW_LIBS="-lregex -liberty"
92 # Misc win32 / mingw checks and variables end
93 #########################################################################
95 ############################################################################
96 # Check for mics things start
98 # Checking for rint in math library
99 AC_CHECK_LIB(m, rint, AC_DEFINE(HAS_RINT, 1, [If your math library has rint in it, define this]), no_RINT="yes")
101 # Checking for dynamic lib
102 AC_CHECK_LIB(dl, dlopen, DL_LIB="-ldl", DL_LIB="")
104 # Check for mics things start
105 ############################################################################
107 ############################################################################
108 # Check for libgeda start
110 PKG_CHECK_MODULES(LIBGEDA, libgeda >= $DATE_VERSION, LIBGEDA="yes",
113 if test "$LIBGEDA" = "yes"
115 LIBGEDA_VERSION=`$PKG_CONFIG libgeda --modversion`
117 AC_MSG_ERROR([libgeda detection error: $LIBGEDA_PKG_ERRORS])
121 # Check for libgeda end
122 ############################################################################
124 ############################################################################
125 # Check for gtk+ 2.4 start
128 # Check for pkg-config
129 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
130 if test $PKG_CONFIG = no; then
131 AC_MSG_ERROR([Cannot find pkg-config, make sure it is installed and in your PATH])
134 PKG_CHECK_MODULES(GTK24, gtk+-2.0 >= 2.4.0, GTK24="yes", no_GTK24="yes")
136 # This next bit of code figures out what gtk we need to use.
137 if test "$GTK24" = "yes"
140 AC_DEFINE(HAS_GTK24, 1, [If gtk+ 2.4.x has been installed, define this])
141 GTK_CFLAGS=$GTK24_CFLAGS
143 GTK_VERSION=`$PKG_CONFIG gtk+-2.0 --modversion`
146 PKG_CHECK_MODULES(GLIB24, glib-2.0 >= 2.4.0, GLIB24="yes", no_GLIB24="yes")
147 if test "$GLIB24" != "yes"
149 AC_MSG_ERROR([Cannot find glib 2.4.x, install it and rerun ./configure.])
151 GLIB_CFLAGS=$GLIB24_CFLAGS
152 GLIB_LIBS=$GLIB24_LIBS
153 GLIB_VERSION=`$PKG_CONFIG glib-2.0 --modversion`
159 if test "$GTK_VERSION" = ""
161 AC_MSG_ERROR([Cannot find gtk+ 2.4.x or later, please install gtk+.])
165 # Check for gtk+ 2.4 end
166 ############################################################################
168 ############################################################################
169 # Check for glib 2.4 start
172 # Check for pkg-config
173 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
174 if test $PKG_CONFIG = no; then
175 AC_MSG_ERROR([Cannot find pkg-config, make sure it is installed and in your PATH])
178 # Search for glib 2.4.x first (only if we are not forcing the glib to 1.2)
179 if test "$opt_gtkver" != "1.2"
181 PKG_CHECK_MODULES(GLIB24, glib-2.0 >= 2.4.0, GLIB24="yes", no_GLIB24="yes")
184 # This next bit of code figures out what glib we need to use.
185 if test "$GLIB24" = "yes" -a "$opt_gtkver" != "1.2"
187 GLIB_CFLAGS=$GLIB24_CFLAGS
188 GLIB_LIBS=$GLIB24_LIBS
189 GLIB_VERSION=`$PKG_CONFIG glib-2.0 --modversion`
194 if test "$GLIB_VERSION" = ""
196 AC_MSG_ERROR([Cannot find glib 2.4.x, install one of them.])
200 # Check for glib 2.4 end
201 ############################################################################
203 #########################################################################
204 # Checks for header files start
209 AC_CHECK_HEADERS(unistd.h string.h stdlib.h \
210 stdarg.h assert.h fcntl.h errno.h \
213 # Checks for typedefs, structures, and compiler characteristics.
216 # Checks for library functions.
218 AC_CHECK_FUNCS(getcwd strstr vsnprintf snprintf getopt_long)
219 AC_CHECK_FUNCS(strcasecmp strncasecmp stricmp strnicmp)
221 AC_MSG_CHECKING([for optarg in unistd.h])
223 [#include <unistd.h>],
224 [ char *string = optarg; int i = optind; ],
227 AC_MSG_RESULT($optarg_found)
229 if test $optarg_found = yes; then
230 AC_DEFINE(OPTARG_IN_UNISTD, 1, [Define if you have optarg in unistd.h])
234 # Checks for header files start
235 #########################################################################
237 #########################################################################
240 # ------------- dmalloc -------------------
243 AC_MSG_CHECKING([if dmalloc debugging should be enabled])
244 AC_ARG_ENABLE([dmalloc],
245 [ --enable-dmalloc Compile and link with dmalloc for malloc debugging [[default=no]]],
247 if test "X$enable_dmalloc" != "Xno" ; then
249 AC_CHECK_HEADER(dmalloc.h,,
250 AC_ERROR([You have requested dmalloc debugging but dmalloc.h could not be found]))
251 AC_CHECK_LIB(dmalloc,main,,
252 AC_ERROR([You have requested dmalloc debugging but -ldmalloc could not be found]))
253 DMALLOC_LIBS="-ldmalloc"
265 # ------------- ElectricFence -------------------
266 dnl ElectricFence checks
268 AC_MSG_CHECKING([if ElectricFence debugging should be enabled])
269 AC_ARG_ENABLE([efence],
270 [ --enable-efence Link with ElectricFence for malloc debugging [[default=no]]],
272 if test "X$enable_efence" != "Xno" ; then
274 if test "X$with_dmalloc" = "Xyes" ; then
275 AC_ERROR([You have requested both dmalloc and Electric Fence, however only 1 is allowed.])
277 AC_CHECK_LIB(efence,main,,
278 AC_ERROR([You have requested ElectricFence debugging but -lefence could not be found]))
289 #########################################################################
291 #########################################################################
293 # Change default location for pcb's newlib library directory
297 AC_MSG_CHECKING([For the default pcb installation data directory])
298 AC_ARG_WITH(pcb-datadir,
299 [ --with-pcb-datadir=path
300 Change the default location for an installed pcb. This is used
301 to set the default search path for pcb newlib libraries.
302 [[default=${datadir}]]],
303 [PCBDATADIR=$withval],
304 [PCBDATADIR="${datadir}"]
306 AC_MSG_RESULT([${PCBDATADIR}])
307 CPPFLAGS="$CPPFLAGS -DPCBDATADIR=\\\"${PCBDATADIR}\\\""
309 AC_MSG_CHECKING([For the default pcb newlib search path])
310 AC_ARG_WITH(pcb-newlib-path,
311 [ --with-pcb-newlib-path=path
312 Change the default search path for PCB newlib libraries
313 [[default=${datadir}/pcb/pcblib-newlib:${datadir}/pcb/newlib]]],
314 [PCBLIBPATH=$withval],
315 [PCBLIBPATH="${PCBDATADIR}/pcb/pcblib-newlib:${PCBDATADIR}/pcb/newlib"]
317 AC_MSG_RESULT([${PCBLIBPATH}])
318 CPPFLAGS="$CPPFLAGS -DPCBLIBPATH=\\\"${PCBLIBPATH}\\\""
321 #########################################################################
323 #########################################################################
324 # Check for groff start
328 AC_PATH_PROG(GROFF, groff, no, ${PATH})
329 if test $GROFF = "no"; then
330 echo "Cannot find groff, some documentation will not be created."
334 # Check for groff end
335 #########################################################################
337 #########################################################################
338 # gEDA/gaf specify setup start
342 GEDADATADIR=$datadir/$DATADIR
344 if eval "test x$opt_rcdir = x"; then
345 # path not was specified with --with-rcdir
346 AC_DEFINE_UNQUOTED(GEDARCDIR, "none", [gEDA/gaf's rc directory])
347 GEDARCDIR=$GEDADATADIR
349 # path WAS specified with --with-rcdir
350 AC_DEFINE_UNQUOTED(GEDARCDIR, "$opt_rcdir", [gEDA/gaf's rc directory])
351 GEDARCDIR="$opt_rcdir"
354 # Expand the prefix variable
355 # I don't like the way this is done, but it works (I hope).
356 if eval "test x$prefix = xNONE"; then
357 dprefix=$ac_default_prefix
362 gedatopdir=$dprefix/share/$DATADIR
363 expandgedadatadir=`echo $gedatopdir`
365 gedadocdir=$dprefix/share/doc/geda-doc
366 # --with-docdir : tells where to store documentation if not default
368 [ --with-docdir Where to store documentation if not default.],
370 expandgedadocdir=`echo $gedadocdir`
371 GEDADOCDIR=$expandgedadocdir
373 # this has to be expanded ( no ${prefix} ) --
374 AC_DEFINE_UNQUOTED(GEDADATADIR, "$gedatopdir", [gEDA/gaf's data directory])
375 AC_DEFINE_UNQUOTED(DATE_VERSION, "$DATE_VERSION", [Currently running date version of gEDA/gaf])
376 AC_DEFINE_UNQUOTED(DOTTED_VERSION, "$DOTTED_VERSION", [Currently running dotted version of gEDA/gaf])
377 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this program's package])
380 # gEDA/gaf specify things which need to setup
381 #########################################################################
383 # Finally create the final CFLAGS and LDFLAGS for use in the makefiles
384 GSCHLAS_CFLAGS="$LIBGEDA_CFLAGS"
385 GSCHLAS_LDFLAGS="$LIBGEDA_LIBS $GTK_LIBS"
386 GSCH2PCB_CFLAGS="$GLIB_CFLAGS $MINGW_CFLAGS"
387 GSCH2PCB_LDFLAGS="$GLIB_LIBS $MINGW_LIBS"
388 GRENUM_CFLAGS="$LIBGEDA_CFLAGS"
389 GRENUM_LDFLAGS="$GLIB_LIBS"
391 # Makefile.in variable substitution
392 AC_SUBST(DATE_VERSION)
393 AC_SUBST(DOTTED_VERSION)
394 AC_SUBST(GSCHLAS_CFLAGS)
395 AC_SUBST(GSCHLAS_LDFLAGS)
396 AC_SUBST(GSCH2PCB_CFLAGS)
397 AC_SUBST(GSCH2PCB_LDFLAGS)
398 AC_SUBST(GRENUM_CFLAGS)
399 AC_SUBST(GRENUM_LDFLAGS)
400 AC_SUBST(MINGW_CFLAGS)
403 AC_SUBST(GEDADATADIR)
406 AC_SUBST(OTHERPATHSEP)
408 # Create all the necessary derived files
409 AC_CONFIG_FILES([Makefile
411 examples/gmk_sym/Makefile
412 examples/tragesym/Makefile
413 examples/gsch2pcb/Makefile
423 tests/refdes_renum/Makefile
424 tests/refdes_renum/inputs/Makefile
425 tests/refdes_renum/outputs/Makefile
430 expandedGEDADATADIR=`eval "echo $GEDADATADIR"`
431 expandedGEDARCDIR=`eval "echo $GEDARCDIR"`
432 expandedGEDADOCDIR=`eval "echo $GEDADOCDIR"`
433 expandedPCBLIBPATH=`eval "echo $PCBLIBPATH"`
436 ** Configuration summary for $PACKAGE $DOTTED_VERSION.$DATE_VERSION:
438 GTK+ library version: $GTK_VERSION
439 GLIB library version: $GLIB_VERSION
440 libgeda library version: $LIBGEDA_VERSION
442 data directory: $expandedGEDADATADIR
443 rc directory: $expandedGEDARCDIR
444 documentation directory: $expandedGEDADOCDIR
445 default pcb newlib path: $expandedPCBLIBPATH
446 dmalloc debugging: $with_dmalloc
447 Electric Fence debugging: $with_efence