File: configure.in

package info (click to toggle)
geda-gsymcheck 19991011-4
  • links: PTS
  • area: main
  • in suites: potato
  • size: 788 kB
  • ctags: 120
  • sloc: sh: 7,330; ansic: 919; makefile: 85
file content (366 lines) | stat: -rw-r--r-- 9,330 bytes parent folder | download
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
dnl Process this file with autoconf to produce a configure script.
AC_INIT(src/gsymcheck.c)

dnl Initialize automake stuff
PACKAGE=gEDA

# new way of doing version
VERSION=19991011

echo Configuring gsymcheck version $VERSION

dnl --disable-strokes : turn off stroke support
AC_ARG_ENABLE(strokes,
    [  --disable-strokes       Disable stroke support (don't use LibStroke at all)],
    [
	no_strokes=yes
    ])

dnl --disable-gdgeda : turn off libgdgeda support
AC_ARG_ENABLE(gdgeda,
    [  --disable-gdgeda        Disable libgdgeda support (don't use libgdgeda at all)],
    [
	no_gdgeda=yes
    ])


dnl Change default location of gtk-config
AC_ARG_WITH(gtk-config, [  --with-gtk-config=path  Change where gtk-config is located], [opt_gtkconfig=$withval])

dnl Change default location of glib-config
AC_ARG_WITH(glib-config, [  --with-glib-config=path  Change where glib-config is located], [opt_libconfig=$withval])

dnl Change default location for rc files
AC_ARG_WITH(rcdir, [  --with-rcdir=path       Change where the system-*rc files are installed], [opt_rcdir=$withval])

dnl Initialize automake stuff
dnl AM_INIT_AUTOMAKE($PACKAGE, $GEDA_VER_MAJOR.$GEDA_VER_MINOR.$GEDA_VER_MICRO, no-define)
AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)

dnl Create a configuration header
AM_CONFIG_HEADER(config.h)

dnl Build time sanity check...
AM_SANITY_CHECK

dnl Initialize libtool libtool isn't really needed for symcheck
AM_PROG_LIBTOOL

dnl Check to see if we are building in the cygnus win32 environment
AC_CYGWIN

dnl Initialize maintainer mode
AM_MAINTAINER_MODE

dnl Checks for programs.
AC_PROG_CC
dnl AC_PROG_LEX
dnl AC_DECL_YYTEXT
AC_PROG_MAKE_SET

dnl Check for guile-config; use it to set 
dnl GUILE_INCLUDE and GUILE_LIB.
dnl Issue: Is it OK to include "-L" in GUILE_LIB?

AC_PATH_PROG(GUILE_CONFIG_PROG, guile-config)

if test ! -n "$GUILE_CONFIG_PROG" ; then
		AC_MSG_ERROR(Cannot find guile-config -- Install GUILE 1.3 and run ./configure again)
fi

	guile_incdir=`$GUILE_CONFIG_PROG info includedir`
	guile_libdir=`$GUILE_CONFIG_PROG info libdir`
	guile_libs=`$GUILE_CONFIG_PROG link`
	GUILE_INCLUDE="-I${guile_incdir}"
	GUILE_LIB="-L${guile_libdir} ${guile_libs}"

saved_cflags="$CFLAGS"
saved_ldflags="$LDFLAGS"

dnl Checks for header files.
AC_PATH_X
AC_PATH_XTRA

CFLAGS="$X_CFLAGS $CFLAGS"
LDFLAGS="$X_LDFLAGS $X_LIBS $LDFLAGS"
X_EXTRA_LIBS="$X_EXTRA_LIBS -lX11 -lm"

dnl Checks for X libraries.
AC_CHECK_LIB(X11, XOpenDisplay, X_LIBS="-lX11", X_LIBS=no, $X_EXTRA_LIBS)
AC_CHECK_LIB(Xext, XShmAttach, X_LIBS="-lXext $X_LIBS", X_EXT=no, $X_EXTRA_LIBS)
dnl AC_CHECK_LIB(Xext, XShmAttach, X_LIBS="-lXext $X_LIBS", XEXT=no, $X_EXTRA_LIBS)

if test "$CYGWIN"x = x; then
	if test "$X_LIBS" = no; then
          AC_MSG_ERROR(Cannot find -lX11 library)
        fi
else 
	echo X11 not require for CYGWIN port
fi

dnl Checking for rint in math library
AC_CHECK_LIB(m, rint, AC_DEFINE(HAS_RINT), no_RINT="yes")

dnl Checking for dynamic lib
AC_CHECK_LIB(dl, dlopen, DL_LIB="-ldl", DL_LIB="")

if eval "test x$opt_gtkconfig != x" ; then

	if test ! -r "$opt_gtkconfig"; then

		AC_MSG_ERROR(Cannot find $opt_gtkconfig -- be sure that this pathname is correct)

	else
		GTKCONFIG=$opt_gtkconfig
	fi
else
 	AC_PATH_PROG(GTKCONFIG, gtk-config, no, ${PATH})
fi


if test $GTKCONFIG = "no"; then
   	  AC_MSG_ERROR(Cannot find gtk-config -- be sure that gtk >= 0.99.7 is installed)
fi

# search for glib-config
if eval "test x$opt_glibconfig != x" ; then

	if test ! -r "$opt_glibconfig"; then

		AC_MSG_ERROR(Cannot find $opt_glibconfig -- be sure that this pathname is correct)

	else
		GLIBCONFIG=$opt_glibconfig
	fi
else
 	AC_PATH_PROG(GLIBCONFIG, glib-config, no, ${PATH})
fi


if test $GLIBCONFIG = "no"; then
   	  AC_MSG_ERROR(Cannot find lib-config -- be sure that gtk >= 0.99.7 is installed)
fi

# search for libgdgeda-config
AC_PATH_PROG(LIBGDGEDACONFIG, libgdgeda-config, no, ${PATH})

if test $LIBGDGEDACONFIG = "no"; then
         libgdgeda_ldflags=""
         libgdgeda_cflags=""
else
         libgdgeda_ldflags=`$LIBGDGEDACONFIG --libs`
         libgdgeda_cflags=`$LIBGDGEDACONFIG --cflags`
         GD_EXTRA="$libgdgeda_cflags $libgdgeda_ldflags -lm"
fi

AC_CHECK_LIB(gdgeda, gdImageColorAllocate, GDGEDA_LIB="-lgdgeda", GDGEDA_LIB=no, $GD_EXTRA)

if test $GDGEDA_LIB = no; then
        GDGEDA_LIB=""
else
        if test "$no_gdgeda" = "yes"; then
                echo found libgdgeda, but disabling gdgeda
                GDGEDA_LIB=""
		libgdgeda_ldflags=""
		libgdgeda_cflags=""
        else
                AC_CHECK_LIB(z, zlibVersion, Z_LIB="-lz", Z_LIB=no)
                if test $Z_LIB = no; then
                        AC_MSG_ERROR(Cannot find libz (zlib), be sure to install zlib; it is required for libgdgeda)
               	fi 

		PNG_EXTRA="-lz -lm"
                AC_CHECK_LIB(png, png_read_init, PNG_LIB="-lpng", PNG_LIB=no, $PNG_EXTRA)
                if test $PNG_LIB = no; then
                        AC_MSG_ERROR(Cannot find libpng, be sure to install png; it is required for libgdgeda)
               	fi 

                AC_DEFINE(HAS_LIBZ)
                AC_DEFINE(HAS_LIBPNG)
                AC_DEFINE(HAS_LIBGDGEDA)
        fi
fi


# search for libgeda-config
AC_PATH_PROG(LIBGEDACONFIG, libgeda-config, no, ${PATH})

if test $LIBGEDACONFIG = "no"; then
	AC_MSG_ERROR(Cannot find libgeda-config -- be sure that libgeda is installed)
fi

# search for gesym-config
AC_PATH_PROG(GESYMCONFIG, gesym-config, no, ${PATH})

if test $GESYMCONFIG = "no"; then
   	  AC_MSG_ERROR(Cannot find gesym-config -- be sure that the symbols are installed)
	fi

LDEXTRA=
CFEXTRA=
GTK=
GDK=
GLIB=
X_LDFLAGS="`$LIBGEDACONFIG --libs` $libgdgeda_ldflags `$GLIBCONFIG --libs`"
X_CFLAGS="`$GTKCONFIG --cflags` $libgdgeda_cflags `$LIBGEDACONFIG --cflags`"
gtkversion=`$GTKCONFIG --version | cut -d. -f1,2`

AC_DEFINE_UNQUOTED(GTKVERSION, "$gtkversion")

dnl set a #define for a new version of gtk 
dnl and step the prototype.h files
if eval "test $gtkversion = '1.2'" ; then
	AC_DEFINE(GTK_DEVEL)

	echo Found GTK+ 1.2.x
#  ( cd src; rm -f prototype.h ; ln -f -s prototype1.2.h prototype.h )
else 
	echo Found GTK+ 1.0.x
   	AC_MSG_ERROR(GTK+ 1.0.x is no longer supported by gEDA, please upgrade to 1.2.x)
fi


dnl old way of doing this, see if new way works 
dnl CFLAGS="$CFLAGS $CFEXTRA `$GTKCONFIG --cflags`"

CFLAGS="`$GTKCONFIG --cflags` $CFLAGS $CFEXTRA"
LDFLAGS="$LDEXTRA `$GTKCONFIG --libs` -lgtk -lgdk -lglib $LDFLAGS -lm"

AC_MSG_CHECKING([for the rest of gtk])
AC_TRY_COMPILE(
[#include <gtk/gtk.h>],
[GtkArgSetFunc arg_set_func;],
gtk_found=yes,
gtk_found=no)
AC_MSG_RESULT($gtk_found)

if test $gtk_found = no; then
	AC_MSG_ERROR(Cannot include/link gtk/gdk/glib--check CFLAGS/LDFLAGS)
fi

AC_CHECK_LIB(stroke, stroke_init, STROKE_LIB="-lstroke", STROKE_LIB=no)

if test $STROKE_LIB = no; then
	STROKE_LIB=""
else 
	if test "$no_strokes" = "yes"; then
		echo found libstroke, but disabling strokes
		STROKE_LIB=""
	else 
		AC_DEFINE(HAS_LIBSTROKE)
	fi
fi

LDFLAGS="$saved_ldflags $LDEXTRA"
CFLAGS="$saved_cflags $CFEXTRA"

AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_HEADER_DIRENT
AC_CHECK_HEADERS(fcntl.h unistd.h strings.h)

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

dnl Checks for library functions.
AC_TYPE_SIGNAL
AC_CHECK_FUNCS(getcwd strstr vsnprintf snprintf)

AC_MSG_CHECKING([for optarg in unistd.h])
AC_TRY_COMPILE(
[#include <unistd.h>],
[ char *string = optarg; int i = optind; ],
optarg_found=yes,
optarg_found=no)
AC_MSG_RESULT($optarg_found)

if test $optarg_found = yes; then
		AC_DEFINE(OPTARG_IN_UNISTD)
fi

#
# Defs for libary symbol files
#
# Expand the prefix variable
if eval "test x$prefix = xNONE"; then
 dprefix=$ac_default_prefix
else
 dprefix=$prefix
fi

gedatopdir=`$GESYMCONFIG --toplevel`
expandgedadatadir=`echo $gedatopdir`

symdir=$gedatopdir/sym
sourcedir=$gedatopdir/source

HOME=`echo $HOME`

# new way without version
gedadatadir=$datadir/$PACKAGE

if eval "test x$opt_rcdir = x"; then

	if eval "test x$prefix = xNONE"; then
		rclocation=$expandgedadatadir
	else
		rclocation=`eval echo $gedadatadir`
	fi

	# this needs to be expanded (NO ${prefix}) since it's used in the code
	AC_DEFINE_UNQUOTED(GEDARCDIR, "$rclocation")
	expandgedarcdir=$rclocation

	# this is used in the makefiles so it can have a ${prefix} in it
	gedarcdir=$gedadatadir
else

	# path WAS specified with --with-rcdir
	gedarcdir=$opt_rcdir
	expandgedarcdir=$opt_rcdir
	AC_DEFINE_UNQUOTED(GEDARCDIR, "$opt_rcdir")

fi


AC_DEFINE_UNQUOTED(GEDADATADIR, "$gedatopdir")
AC_DEFINE_UNQUOTED(VERSION, "$VERSION")

# old way of installing data into a version dependant directory
#gedadatadir=$datadir/$PACKAGE-$VERSION
# new way without version
gedadatadir=$datadir/$PACKAGE

AC_SUBST(gedadatadir)
AC_SUBST(gedarcdir)
AC_SUBST(expandgedadatadir)
AC_SUBST(expandgedarcdir)
AC_SUBST(symdir)
AC_SUBST(sourcedir)

AC_SUBST(HOME)
AC_SUBST(VERSION)
AC_SUBST(GTKVERSION)
AC_SUBST(GTK_DEVEL)

AC_SUBST(X_CFLAGS)
AC_SUBST(X_LDFLAGS)
AC_SUBST(X_LIBS)
AC_SUBST(STROKE_LIB)
dnl AC_SUBST(TCL_LIB)
AC_SUBST(GUILE_LIB)
AC_SUBST(GUILE_INCLUDE)
AC_SUBST(DL_LIB)
AC_SUBST(GTK)
AC_SUBST(GDK)
AC_SUBST(GLIB)

AC_OUTPUT( 	Makefile \
		src/Makefile \
		include/Makefile \
		scheme/Makefile \
		examples/Makefile \
		lib/Makefile \
		utils/Makefile \
		lib/system-gsymcheckrc )