makefiledir/iconv_detector.c
author bjarni
Thu, 23 Mar 2006 23:54:43 +0000
changeset 3311 138e38fa6fda
permissions -rw-r--r--
(svn r4074) -Feature: [Makefile] the makefile can now detect if iconv is present in the system
if detected, WITH_ICONV will be defined in the C code
WITH_ICONV is also added to Makefile.config
OSX do not use this flag setting in Makefile.config, as it is set at compile time based on target OS version
the actual C code is not changed as the current iconv code is hardcoded for OSX and would break if any other OS got iconv
This detection system is by request of Darkvater
3311
138e38fa6fda (svn r4074) -Feature: [Makefile] the makefile can now detect if iconv is present in the system
bjarni
parents:
diff changeset
     1
/* $Id$ */
138e38fa6fda (svn r4074) -Feature: [Makefile] the makefile can now detect if iconv is present in the system
bjarni
parents:
diff changeset
     2
138e38fa6fda (svn r4074) -Feature: [Makefile] the makefile can now detect if iconv is present in the system
bjarni
parents:
diff changeset
     3
#include <stdlib.h>
138e38fa6fda (svn r4074) -Feature: [Makefile] the makefile can now detect if iconv is present in the system
bjarni
parents:
diff changeset
     4
#include <iconv.h>
138e38fa6fda (svn r4074) -Feature: [Makefile] the makefile can now detect if iconv is present in the system
bjarni
parents:
diff changeset
     5
#include <stdio.h>
138e38fa6fda (svn r4074) -Feature: [Makefile] the makefile can now detect if iconv is present in the system
bjarni
parents:
diff changeset
     6
138e38fa6fda (svn r4074) -Feature: [Makefile] the makefile can now detect if iconv is present in the system
bjarni
parents:
diff changeset
     7
/* this is a pretty simple app, that will return 1 if it manages to compile and execute
138e38fa6fda (svn r4074) -Feature: [Makefile] the makefile can now detect if iconv is present in the system
bjarni
parents:
diff changeset
     8
 * This means that it can be used by the makefile to detect if iconv is present on the current system
138e38fa6fda (svn r4074) -Feature: [Makefile] the makefile can now detect if iconv is present in the system
bjarni
parents:
diff changeset
     9
 * no iconv means this file fails and will return nothing */
138e38fa6fda (svn r4074) -Feature: [Makefile] the makefile can now detect if iconv is present in the system
bjarni
parents:
diff changeset
    10
138e38fa6fda (svn r4074) -Feature: [Makefile] the makefile can now detect if iconv is present in the system
bjarni
parents:
diff changeset
    11
int main ()
138e38fa6fda (svn r4074) -Feature: [Makefile] the makefile can now detect if iconv is present in the system
bjarni
parents:
diff changeset
    12
{
138e38fa6fda (svn r4074) -Feature: [Makefile] the makefile can now detect if iconv is present in the system
bjarni
parents:
diff changeset
    13
	iconv_t cd = iconv_open("","");
138e38fa6fda (svn r4074) -Feature: [Makefile] the makefile can now detect if iconv is present in the system
bjarni
parents:
diff changeset
    14
	iconv(cd,NULL,NULL,NULL,NULL);
138e38fa6fda (svn r4074) -Feature: [Makefile] the makefile can now detect if iconv is present in the system
bjarni
parents:
diff changeset
    15
	iconv_close(cd);
138e38fa6fda (svn r4074) -Feature: [Makefile] the makefile can now detect if iconv is present in the system
bjarni
parents:
diff changeset
    16
	printf("1\n");
138e38fa6fda (svn r4074) -Feature: [Makefile] the makefile can now detect if iconv is present in the system
bjarni
parents:
diff changeset
    17
	return 0;
138e38fa6fda (svn r4074) -Feature: [Makefile] the makefile can now detect if iconv is present in the system
bjarni
parents:
diff changeset
    18
}