File: aclocal.m4

package info (click to toggle)
libgtkada 18-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 28,348 kB
  • sloc: ada: 61,514; xml: 7,709; python: 4,310; sh: 2,822; ansic: 1,598; makefile: 240; objc: 160; perl: 70
file content (523 lines) | stat: -rw-r--r-- 13,890 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
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
#############################################################
#
#  Adding some OS specific flags and parameters
#
############################################################

AC_DEFUN(AM_ADD_OS_SPECIFIC_FLAGS,
[
   SO_EXT=.so
   SO_OPTS=-Wl,-soname,
   TARGET_LFLAGS=
   DEFAULT_LIBRARY_TYPE=static
   NEED_OBJECTIVE_C=no

   AC_ARG_ENABLE(static,
     [AC_HELP_STRING(
        [--disable-static],
        [Disable building of static libraries.])
AC_HELP_STRING(
        [--enable-static],
        [Build static libraries (default).])],
     [BUILD_STATIC=$enableval
      if test $enableval = no; then
         DEFAULT_LIBRARY_TYPE=relocatable
      fi],
     [BUILD_STATIC=yes])

   AC_ARG_ENABLE(static_pic,
     [AC_HELP_STRING(
        [--disable-static-pic],
        [Disable building of static PIC libraries.])
AC_HELP_STRING(
        [--enable-static-pic],
        [Build static PIC libraries (default).])],
     [BUILD_STATIC_PIC=$enableval
      if test $enableval = yes; then
         DEFAULT_LIBRARY_TYPE=static-pic
      fi],
     [BUILD_STATIC_PIC=yes])

   AC_ARG_ENABLE(shared,
     [AC_HELP_STRING(
        [--disable-shared],
        [Disable building of shared libraries (default is to build them if supported on the target)])
AC_HELP_STRING(
        [--enable-shared],
        [Build shared libraries if supported on the target and
make them preselected in project files (static libraries are preselected by default])],
     [CAN_BUILD_SHARED=$enableval
      if test $enableval = yes; then
         DEFAULT_LIBRARY_TYPE=relocatable
      fi],
     [CAN_BUILD_SHARED=yes])

   BUILD_SHARED=$CAN_BUILD_SHARED

   case $build_os in
   aix*)
      BUILD_SHARED=no
      OS_SPECIFIC_LINK_OPTIONS=-Wl,-bexpall,-berok
      TARGET_LFLAGS=-Wl,-bbigtoc
      SO_OPTS="-o "
      ;;
   hp*)
      SO_EXT=.sl
      SO_OPTS=-Wl,+h,
      BUILD_SHARED=no
      ;;
   *sysv4uw* | *sysv5uw*)
      SO_OPTS=-Wl,-h,
      BUILD_SHARED=no
      ;;
   *solaris*)
      SO_OPTS=-Wl,-h,
      ;;
   *irix*)
      ;;
   *osf*)
      OS_SPECIFIC_LINK_OPTIONS=-Wl,-expect_unresolved,\*
      ;;
   *mingw*)
      if test x$CAN_BUILD_SHARED = xyes ; then
         BUILD_SHARED=yes
      fi
      SO_EXT=.dll
      ac_tmp_GNATDIR=`which gcc | sed 's,/gcc$,,'`
      ac_GNATDIR=`cygpath --mixed $ac_tmp_GNATDIR`
      count=`cd $ac_GNATDIR; ls libgnat-*.dll | wc -l`
      if test $count -gt 1 ; then
         echo "Too many libgnat.dll, in $ac_GNATDIR"
	 echo Found: `cd $ac_GNATDIR; ls libgnat-*.dll`
         exit 1
      fi
      ac_GNATLIB=`cd $ac_GNATDIR; ls libgnat-*.dll | sed 's,lib,,;s,.dll,,'`
      OS_SPECIFIC_LINK_OPTIONS=-Wl,-L$ac_GNATDIR,-l$ac_GNATLIB
      ;;
   *darwin*)
      SO_EXT=.dylib
      NEED_OBJECTIVE_C=yes
      if test x$CAN_BUILD_SHARED = xyes ; then
         BUILD_SHARED=yes
      fi
      SO_OPTS="-Wl,-undefined,dynamic_lookup -dynamiclib -Wl,-dylib_install_name,"
      LDFLAGS="$LDFLAGS -Wl,-framework,Cocoa"
      TARGET_LFLAGS="-Wl,-framework,Cocoa"
      ;;
   # ??? The following case has been introduced because of an elaboration
   # problem with the GtkAda dynamic library and GPS (see E511-010). This
   # is a workaround, and shall be removed as soon as the bug is fixed.
   *linux*)
      case $build_cpu in
      *ia64*)
         BUILD_SHARED=no
         ;;
      esac
      ;;
   esac

  if test x$BUILD_SHARED = xno ; then
    if test x$BUILD_STATIC_PIC = xno ; then
       DEFAULT_LIBRARY_TYPE=static
    fi
  fi

  AC_SUBST(DEFAULT_LIBRARY_TYPE)
  AC_SUBST(OS_SPECIFIC_LINK_OPTIONS)
  AC_SUBST(BUILD_STATIC)
  AC_SUBST(BUILD_STATIC_PIC)
  AC_SUBST(BUILD_SHARED)
  AC_SUBST(SO_EXT)
  AC_SUBST(SO_OPTS)
  AC_SUBST(TARGET_LFLAGS)
  AC_SUBST(NEED_OBJECTIVE_C)

]
)

#############################################################
#  Checking for build type
#############################################################

AC_DEFUN(CHECK_BUILD_TYPE,
[
    AC_ARG_ENABLE(build,
       [AC_HELP_STRING(
          [--enable-build=<type>],
          [Default build type for the library (Debug, Production)])],
       BUILD_TYPE=$enableval,
       BUILD_TYPE=Production)
   AC_SUBST(BUILD_TYPE)
]
)

##########################################################################
## Converts a list of space-separated words into a list suitable for
## inclusion in .gpr files
##   $1=the list
##   $2=exported name
##########################################################################

AC_DEFUN(AM_TO_GPR,
[
   value=[$1]

   # Special handling on darwin for gcc 4.5 and 4.7
   case "$build_os" in
      *darwin*)
         value=`echo $value | sed -e "s/-framework \([[^ ]]*\)/-Wl,-framework -Wl,\1/g"`
   esac

   output=$2
   result=""
   for v in $value; do
      if test "$result" != ""; then
         result="$result, "
      fi
      result="$result\"$v\""
   done
   $2=$result
   AC_SUBST($2)
])

#############################################################
#
#  Checking for Gnat
#
#############################################################

conftest_ok="conftest.ok"

AC_DEFUN(AM_PATH_GNAT,
[
   AC_PATH_PROG(GPRBUILD, gprbuild, no)
   AC_PATH_PROG(GPRINSTALL, gprinstall, no)

   if test x$GPRBUILD = xno ; then
      AC_MSG_ERROR(I could not find gprbuild. See the file 'INSTALL' for more details.)
   fi

   AC_MSG_CHECKING(that your gnat compiler works with a simple example)

   rm -f conftest.adb
   cat << EOF > conftest.adb
with Ada.Text_IO;

procedure Conftest is
   Conftest_Ok : Ada.Text_IO.File_Type;
begin
   Ada.Text_IO.Create (File => Conftest_Ok,
                       Name => "$conftest_ok");
   Ada.Text_IO.Close (Conftest_Ok);
end Conftest;
EOF
   cat <<EOF > conftest.gpr
project Conftest is
   for Main use ("conftest.adb");
   for Source_Files use ("conftest.adb");
end Conftest;
EOF

   $GPRBUILD -q -P conftest.gpr > /dev/null
   rm -f auto.cgpr b__conftest.*

   if ( test ! -x conftest ) then
      AC_MSG_RESULT(no)
      AC_MSG_ERROR($GPRBUILD test failed at compile time! Check your configuration.)
   fi

   ./conftest

   if ( test ! -f $conftest_ok ) then
      AC_MSG_RESULT(no)
      AC_MSG_ERROR($GPRBUILD test failed at run time! Check your configuration.)
   fi

   AC_MSG_RESULT(yes)
])


#############################################################
#
#  Checking for gnatprep
#
#############################################################


AC_DEFUN(AM_PATH_GNATPREP,
[
   AC_PATH_PROG(GNATPREP, gnatprep, no)

   if test x$GNATPREP = xno ; then
      AC_MSG_ERROR(I could not find gnatprep. See the file 'INSTALL' for more details.)
   fi

])

#############################################################
#
# Configure paths for GTK+
# Input:
#    $1=minimal version of gtk+ needed
#
#############################################################

AC_DEFUN(AM_PATH_GTK,
[
  AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
  min_gtk_version=[$1]
  AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
  no_gtk=""
  GTK="gtk+-3.0"
  if test "$PKG_CONFIG" = "no" ; then
     AC_MSG_ERROR([pkg-config not found])
  else
    $PKG_CONFIG $GTK --atleast-version=$min_gtk_version
    if test $? != 0 ; then
       AC_MSG_ERROR([old version detected])
    fi

    GTK_PREFIX=`$PKG_CONFIG $GTK --variable=prefix`
    GTK_CFLAGS=`$PKG_CONFIG $GTK --cflags`
    GTK_LIBS=`$PKG_CONFIG $GTK gmodule-2.0 fontconfig --libs`

    dnl
    dnl Now check if the installed GTK is sufficiently new. (Also sanity
    dnl checks the results of pkg-config to some extent
    dnl
    ac_save_CFLAGS="$CFLAGS"
    ac_save_LIBS="$LIBS"
    CFLAGS="$CFLAGS $GTK_CFLAGS"
    LIBS="$LIBS $GTK_LIBS"
    rm -f conf.gtktest
    AC_TRY_LINK([
#include <gtk/gtk.h>
#include <stdio.h>
int
main (int argc, char** argv)
{
  gtk_init(&argc, &argv);
  return 0;
}
],, no_gtk=yes)

    CFLAGS="$ac_save_CFLAGS"
    LIBS="$ac_save_LIBS"
  fi

  if test "x$no_gtk" = x ; then
     AC_MSG_RESULT(yes)
  else
     AC_MSG_ERROR(no)
  fi
  AC_SUBST(GTK_PREFIX)
  AC_SUBST(GTK_CFLAGS)
  AC_SUBST(GTK_LIBS)
  AM_TO_GPR($GTK_CFLAGS, GTK_CFLAGS_GPR)

  dnl On windows gtk will be embedded along with gtk distrib. In that
  dnl case we need to adjust switches so that gtkada.gpr packaged in
  dnl lib/gnat is usable

  case $build_os in
     *mingw*) GTK_LIBS="-L../../lib -L../../bin $GTK_LIBS";;
  esac

  GTK_LIBS="$GTK_LIBS $LIBS"

  AM_TO_GPR($GTK_LIBS, GTK_LIBS_GPR)
  rm -f conf.gtktest
])

#############################################################
#
#  Checking for openGL
#
#############################################################


AC_DEFUN(AM_CHECK_OPENGL,
[

   # checking for OpenGL libraries
   AC_ARG_WITH(GL,         [  --with-GL=value         Which OpenGL library to compile GtkAda with (auto,GL,GL32,MesaGL,,no)])
   AC_ARG_WITH(GL-prefix,  [  --with-GL-prefix=DIR    Prefix where GL/MesaGL is installed])

   if test "x$with_GL_prefix" = "x" ; then
      GL_LDOPTS=""
      GL_CFLAGS=""
   else
      GL_CFLAGS="-I$with_GL_prefix/include"
      case "${host}" in
         *64*)
            GL_LDOPTS="-L$with_GL_prefix/lib64"
            ;;
         *)
            GL_LDOPTS="-L$with_GL_prefix/lib"
            ;;
      esac
   fi

   saved_LIBS="$LIBS"

   if test "x$with_GL" != xno ; then
     AC_MSG_CHECKING([for OpenGL])
     LIBS="$saved_LIBS $GTK_LIBS $GL_LDOPTS -lGLU -lGL -lm -lX11"
     AC_TRY_LINK( ,[ char glBegin(); glBegin(); ], have_GL=yes, have_GL=no)
     AC_MSG_RESULT($have_GL)

     AC_MSG_CHECKING([for GL32])
     LIBS="$saved_LIBS $GTK_LIBS $GL_LDOPTS -lglu32 -lopengl32 -lgdi32"
     AC_TRY_LINK([
#include <GL/gl.h>
#include <windows.h>],
[ glBegin(0);
  CreateCompatibleDC(NULL); ], have_GL32=yes, have_GL32=no)
     AC_MSG_RESULT($have_GL32)

     AC_MSG_CHECKING([for Mesa])
     LIBS="$saved_LIBS $GTK_LIBS $GL_LDOPTS -lMesaGLU -lMesaGL"
     AC_TRY_LINK( ,[ char glBegin(); glBegin(); ], have_MesaGL=yes, have_MesaGL=no)
     AC_MSG_RESULT($have_MesaGL)

     if test "x$have_MesaGL" = "xno"; then
       AC_MSG_CHECKING([Mesa with pthreads])
       LIBS="$saved_LIBS $GTK_LIBS $GL_LDOPTS -lMesaGLU -lMesaGL -lpthread"
       AC_TRY_LINK( ,[ char glBegin(); glBegin(); ], have_MesaGL_pthread=yes, have_MesaGL_pthread=no)
       AC_MSG_RESULT($have_MesaGL_pthread)
     fi
   fi

   LIBS="$saved_LIBS"
   HAVE_OPENGL="False"

   case "x$with_GL" in
   x|xauto)
      if test "x$have_GL" = "xyes"; then
         GL_LIBS="$GL_LDOPTS -lGLU -lGL -lm -lX11"
         HAVE_OPENGL="True"
      elif test "x$have_GL32" = "xyes"; then
         GL_LIBS="$GL_LDOPTS -lglu32 -lopengl32 -lgdi32"
         HAVE_OPENGL="True"
      elif test "x$have_MesaGL" = "xyes"; then
         GL_LIBS="$GL_LDOPTS -lMesaGLU -lMesaGL"
         HAVE_OPENGL="True"
      elif test "x$have_MesaGL_pthread" = "xyes"; then
         GL_LIBS="$GL_LDOPTS -lMesaGLU -lMesaGL -lpthread"
         HAVE_OPENGL="True"
      fi
      ;;
   xGL)
      if test "x$have_GL" = "xyes"; then
         GL_LIBS="$GL_LDOPTS -lGLU -lGL -lm -lX11"
         HAVE_OPENGL="True"
      else
         AC_MSG_ERROR([Missing OpenGL library])
      fi
      ;;
   xGL32)
      if test "x$have_GL" = "xyes"; then
         GL_LIBS="$GL_LDOPTS -lglu32 -lopengl32 -lgdi32"
         HAVE_OPENGL="True"
      else
         AC_MSG_ERROR([Missing Windows OpenGL library])
      fi
      ;;
   xMesaGL)
      if test "x$have_MesaGL" = "xyes"; then
         GL_LIBS="$GL_LDOPTS -lMesaGLU -lMesaGL"
         HAVE_OPENGL="True"
      elif test "x$have_MesaGL_pthread" = "xyes"; then
         GL_LIBS="$GL_LDOPTS -lMesaGLU -lMesaGL -lpthread"
         HAVE_OPENGL="True"
      else
         AC_MSG_ERROR([Missing Mesa library])
      fi
      ;;
   xno)
      ;;
   *)
      AC_MSG_ERROR([Unknown value for "--with-GL" option. Should be either auto, GL32, GL, MesaGL, no])
      ;;
   esac

   AC_SUBST(GL_LIBS)
   AC_SUBST(GL_CFLAGS)
   AC_SUBST(HAVE_OPENGL)
   AM_TO_GPR($GL_LIBS, GL_LIBS_GPR)
   AM_TO_GPR($GL_CFLAGS, GL_CFLAGS_GPR)
])

#############################################################
#
#  A small macro to create a file after preprocessing it using gnatprep
#
#############################################################


AC_DEFUN(AM_GNATPREP,
[
   echo "creating $1"
   $GNATPREP $1.in $1 config.defs
])


#############################################################
#
#  Macro to add for using GNU gettext
#
#############################################################


AC_DEFUN(AM_WITH_NLS,
  [AC_MSG_CHECKING([whether NLS is requested])
    dnl Default is enabled NLS
    AC_ARG_ENABLE(nls,
      [  --disable-nls           do not use Native Language Support],
      USE_NLS=$enableval, USE_NLS=yes)
    AC_MSG_RESULT($USE_NLS)
    AC_SUBST(USE_NLS)

    GETTEXT_INTL="False"
    HAVE_GETTEXT="False"

    dnl If we use NLS figure out what method
    if test "$USE_NLS" = "yes"; then
      AC_DEFINE(ENABLE_NLS)

      dnl Figure out whether gettext is available in the C or intl library.
      nls_cv_header_intl=
      nls_cv_header_libgt=

      AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
       [AC_TRY_LINK([extern int gettext(char*);], [return (int) gettext ("")],
	gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])

      if test "$gt_cv_func_gettext_libc" != "yes"; then
        AC_CHECK_LIB(intl, bindtextdomain,
         [AC_CACHE_CHECK([for gettext in libintl],
           gt_cv_func_gettext_libintl,
           [AC_CHECK_LIB(intl, gettext,
              gt_cv_func_gettext_libintl=yes,
              gt_cv_func_gettext_libintl=no)],
	    gt_cv_func_gettext_libintl=no)])

	  if test "$gt_cv_func_gettext_libintl" = "yes"; then
            GETTEXT_INTL="True"
          fi
      fi

       if test "$gt_cv_func_gettext_libc" = "yes" \
         || test "$gt_cv_func_gettext_libintl" = "yes"; then
            HAVE_GETTEXT="True"
       fi
    fi

    dnl Make all variables we use known to autoconf.
    AC_SUBST(GETTEXT_INTL)
    AC_SUBST(HAVE_GETTEXT)
  ])

AC_DEFUN(AM_GNU_GETTEXT,
  [AM_WITH_NLS
  ])