summaryrefslogtreecommitdiffstats
path: root/configure.in.in
blob: 4d830565f7d80b1def498ece03fa03eb12bbc16a (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
#MIN_CONFIG(3.2.0)

AM_INIT_AUTOMAKE(ktechlab, 0.3)
AC_C_BIGENDIAN
AC_CHECK_KDEMAXPATHLEN


################################
## BEGIN Check for gpsim 0.21 ##
################################

AC_LANG_SAVE
AC_LANG_CPLUSPLUS
ktechlab_save_CXXFLAGS="$CXXFLAGS"

AC_ARG_WITH(glib12, [  --with-glib12           force using glib 1.2.x [default=no]])
if test "x$with_glib12" != "xyes" ; then
	glib_cflags=`pkg-config --cflags glib-2.0`
else
	glib_cflags=`glib-config --cflags`
fi
AC_SUBST(glib_cflags)

CXXFLAGS="$glib_cflags"

AC_MSG_CHECKING([for gpsim 0.21.4 availability])
AC_TRY_COMPILE(
	[
#include <gpsim/interface.h>
#include <gpsim/gpsim_interface.h>
#include <gpsim/breakpoints.h>
#include <gpsim/gpsim_time.h>
void func() { (void)cycles; (void)initialize_gpsim_core(); (void)load_symbol_file(0,0); }
	],
	[],
	AC_MSG_RESULT( yes )
	have_gpsim_0_21_4=yes,
	AC_MSG_RESULT( no )
)

AC_MSG_CHECKING([for gpsim 0.21.11 availability])
AC_TRY_COMPILE(
	[
#include <gpsim/interface.h>
#include <gpsim/gpsim_interface.h>
#include <gpsim/breakpoints.h>
#include <gpsim/gpsim_time.h>
#include <gpsim/symbol.h>
#include <gpsim/program_files.h>
void func() { (void)cycles; (void)initialize_gpsim_core(); }
	],
	[],
	AC_MSG_RESULT( yes )
	have_gpsim_0_21_11=yes,
	AC_MSG_RESULT( no )
)

AC_MSG_CHECKING([for gpsim 0.21.12 availability])
AC_TRY_COMPILE(
	[
#include <gpsim/ValueCollections.h>
	],
	[],
	AC_MSG_RESULT( yes )
	have_gpsim_0_21_12=yes,
	AC_MSG_RESULT( no )
)

CXXFLAGS="$ktechlab_save_CXXFLAGS"
AC_LANG_RESTORE

##############################
## END Check for gpsim 0.21 ##
##############################



################################
## BEGIN DO_NOT_COMPILE CHECK ##
################################

if test x$have_gpsim_0_21_12 == xyes; then
	AC_DEFINE([GPSIM_0_21_12],[],[Gpsim 0.21.12 was found])
	CXXFLAGS="$CXXFLAGS $USE_EXCEPTIONS"
else
	if test x$have_gpsim_0_21_4 != xyes; then
		if test x$have_gpsim_0_21_11 != xyes; then
			AC_DEFINE([NO_GPSIM],[],[Gpsim was not found])
			LIB_GPSIM=""
		else
			AC_DEFINE([GPSIM_0_21_11],[],[Gpsim 0.21.11 was found])
		fi
	else
		AC_DEFINE([GPSIM_0_21_4],[],[Gpsim 0.21.4 was found])
	fi
fi

if test x$have_gpsim_0_21_4 == xyes || test x$have_gpsim_0_21_11 == xyes || test x$have_gpsim_0_21_12 == xyes; then
	wi_cv_lib_readline=no
	ac_save_LIBS="$LIBS"
	# Note: $LIBCURSES is permitted to be empty.
	for LIBREADLINE in "-lreadline" "-lreadline $LIBCURSES" "-lreadline -ltermcap" "-lreadline -lncurses" "-lreadline -lcurses"
	do
		LIBS="$ac_save_LIBS $LIBREADLINE"
		LIB_GPSIM="$LIBREADLINE -lgpsim -lgpsim_eXdbm -lgpsimcli -lgpsimgui"
		AC_TRY_RUN([
			/* program */
			#include <stdio.h>
			#include <stdlib.h>
		 
			main(int argc, char **argv)
			{
				/* Note:  don't actually call readline, since it may block;
				 * We just want to see if it (dynamic) linked in okay.
				 */
				if (argc == 0)	/* never true */
					readline(0);
				exit(0);
			}
		],[
		# action if true
			wi_cv_lib_readline=yes
		],[
			# action if false
			wi_cv_lib_readline=no
	],[
		# action if cross compiling
		wi_cv_lib_readline=no
	])
	
		if test "$wi_cv_lib_readline" = yes ; then break ; fi
	done

	LIBS="$ac_save_LIBS"
fi

AC_SUBST(LIB_GPSIM)

##############################
## END DO_NOT_COMPILE CHECK ##
##############################